Relatively Simple Scenario:
I have this Voucher object which has a user property (of type ObjectId). I want to get the sum of
Voucher
user
ObjectId
var aggregate = [ { $match: { 'lenderId': new mongoose.Types.ObjectId(req.user), '_disbursed': true } }, { $unwind:'$emi' }, { $match: { 'emi._settled': false, } } ];