Invalid $project :: caused by :: Unrecognized expression '$$varientPricePoint.ppId'
{
"pricepoint": {
"$filter": {
"input": "$OriginalPricePoints",
"as": "varientPricePoint",
"cond": {
"$$varientPricePoint.ppId": {
"$in": ["PP100"]
}
}
}
},
"_id": 0
}
CodePudding user response:
You can't use the variable as the root object key, instead you need wrap with $in
operator as below:
{
"pricepoint": {
"$filter": {
"input": "$OriginalPricePoints",
"as": "varientPricePoint",
"cond": {
$in: [
"$$varientPricePoint.ppId",
["PP100"]
]
}
}
}
}