I need to be able to parse deeply nested string value to be able to find an amount greater than in my request query. I fount that $expr operator is supposed to help in that, but when i try to implement it it gives me
"message" : "unknown operator: $expr",
here is my code:
db.OrderAttributes.find({
InfluencedAttributes: {$elemMatch: {
LexisAttributes:{$elemMatch: {
$expr: { $gt: [ {$toDouble: "$MyAttributes.MyField"}, 500]}
}}
}}
}
the value I'm trying to compare is here
InfluencedAttributes.0.LexisAttributes.0.MyAttributes.MyField = "20000"
trimmed version of the lookup document:
db.OrderAttributes.insertOne({
"InfluencedAttributes" : [
{
"LexisAttributes" : [
{
"MyAttributes" : {
"MyValue" : "20000"
}
},
{
...
},
{
...
}
]
}
]
}})