Monday, 4 January 2021

3 level object in MongoDb Condition

SubscribePlan.aggregate([ { $match: { "subscriberId": subscriberId } }, { "$addFields": { "planId1": { "$toString": "$planId" } } }, { "$lookup": { "from": "Signal", // "let": { "planId0": "$package_id", "mentorId": "$mentorId" }, "let": { "planId0": "$planId" },//privous collection "pipeline": [ { "$match": { "$expr": { "$eq": ["$package_id", "$$planId0"] } } }, { "$lookup": { "from": "mentors", "let": { "mentorId0": { "$toObjectId": "$mentorId" } }, //privous collection "pipeline": [ { "$match": { "$expr": { "$eq": ["$_id", "$$mentorId0"] } } } ], "as": "mentorDetail", } }, { "$unwind": "$mentorDetail" } ], "as": "signal", } }, { "$unwind": "$signal" } ]) .then(mySignal => { res.send({ myPlamSignals: mySignal }); }).catch(err => { res.status(500).send({ Message: err.message, Result: false, data: err }); })

No comments:

Post a Comment

IIS deployment support details

  Node JS - IIS deployment support details node: http://go.microsoft.com/?linkid=9784334 IISNode: https://github.com/azure/iisnode/releases/...