Aggregate query with where condition Aggregate query with where condition mongodb mongodb

Aggregate query with where condition


Something like:

db.myTable.aggregate([  { $match: { mydate: { $lte: new Date('12/01/1998') } } },  { $group: {    _id: "$keyid",    totalqty: { $sum: "$qty" }  }}])


Can use this -

db.schoolexamregistration.aggregate([    { $match: {"exam_session_id":"1523850138707"} },{     $lookup:       {         from: "student",         localField: "nic_ppt",         foreignField: "nic_ppt",         as: "student_detail"       }    }  ])