We are getting “Use of undefined variable: SEARCH_META” when executing this query:
db.getCollection("clients").aggregate([
{
$search: {
compound: {
must: [
{
equals: {
value: ObjectId("62aa72d4a152e94836d05dc9"),
path: "externalId"
}
},
{
equals: {
value: false,
path: "isDeleted"
}
},
{
wildcard: {
query: '*James*',
path: ["email", "firstname", "lastname"],
allowAnalyzedField: true
}
}
]
},
"count": {
"type": "total"
}
}
},
{
$sort: {
"firstname": 1
}
},
{
$project: {
"meta": "$$SEARCH_META",
"_id": 1,
"email": 1,
"firstname": 1,
"lastname": 1
}
},
{
$skip: 0
},
{
$limit: 10
}])
Any help would be greatly appreciated