I have a collection rawUnits. I am getting the latest record from this collection using
db.getCollection('rawUnits').find().limit(1).sort({$natural:-1})
This gives me the record which has a nested field saleinfo.group.id I want to get the value for this field how do I do that?
You can
$projectit:But it is better to limit your search, if you filter by any field...