Include All Document Fields At All Levels Based On The Field Value
i want to create roll based menu if some having permission to view cavoucher,puvendor forms here i know only form name nothing else and also the form name could be any where define
Solution 1:
It can be done using the aggregation pipeline in MongoDB.
Here in your case you have two nested arrays subMenu1
and subMenu2
first $unwind them and then use $match to achieve the result.
Mongo Shell Query
db.collection.aggregate([
{$unwind:"$subMenu1"},
{$unwind:"$subMenu1.subMenu2"},
{$match:{"subMenu1.subMenu2.formName":"cavoucher"}}
])
Post a Comment for "Include All Document Fields At All Levels Based On The Field Value"