Mongodb Lookup With Condition

[Solved] Mongodb Lookup With Condition | Perl - Code Explorer | yomemimo.com
Question : mongodb lookup with condition

Answered by : dhaval-italiya

var re = new RegExp("beg", "i"); let data = await accounts.aggregate([ { $match: { _id: mongoose.Types.ObjectId(req.params.userId), }, }, { $lookup: { from: "begs", localField: "_id", foreignField: "userId", as: "begCount", pipeline: [{ $match: { title: re } }], }, }, ]);

Source : | Last Update : Fri, 14 Oct 22

Answers related to mongodb lookup with condition

Code Explorer Popular Question For Perl