I wrote a MongoDB pipeline that has this code in it:
{
$eq: [
{
"$toLower": "HELLO"
},
"hello"
]
}
And here's a screenshot of it in Mongo Compass
I am expecting it to simply return true, and "$match" everything (for now).
Eventually I will swap "HELLO"
with a field name etc.
Does anyone know why I am getting this error?
$match does not accept raw aggregation expressions. Instead, use a $expr query expression to include aggregation expression in $match.
https://docs.mongodb.com/manual/reference/operator/aggregation/match/index.html#pipe._S_match
$expr: {
$eq: [
{
$toLower: "HELLO"
},
"hello"
]
}