Question : how to use id in aggregate
Answered by : salo-hopeless
const ObjectId = mongoose.Types.ObjectId;
const User = mongoose.model('User')
User.aggregate([ { $match: { _id: ObjectId('560c24b853b558856ef193a3') } }
])
Source : https://stackoverflow.com/questions/32877064/how-to-use-aggregrate-in-mongodb-to-match-id/43199139 | Last Update : Mon, 09 Nov 20