Mongodb Aggregate Match Objectid

[Solved] Mongodb Aggregate Match Objectid | Perl - Code Explorer | yomemimo.com
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

Answers related to mongodb aggregate match objectid

Code Explorer Popular Question For Perl