I am using $facet, it works fine with my mlab, but when I connect to azure cosmos DB it says
{"error":{"ok":0,"errmsg":"Unrecognized pipeline stage name: $facet","code":40324,"codeName":"40324","name":"MongoError"}}
I am using below query
collection.aggregate([{
$match: "test"
},
{
$facet: {
metadata: [{
$count: "total"
}
],
data: [{
$project: {
fieldname: 1,
}
}
]
}
}
])```
As per below documented links, AZURE and AWS do not support $facet.
https://learn.microsoft.com/es-es/azure/cosmos-db/mongodb-feature-support-36#aggregation-stages
https://docs.aws.amazon.com/documentdb/latest/developerguide/mongo-apis.html#w144aac17c19b5b3