mongo-parse
mongo-parse copied to clipboard
Queries with $expr are not fully implemented
Consider the following query:
{
$expr: {
$lt:[ {
$cond: {
if: { $gte: ["$qty", 100] },
then: { $divide: ["$price", 2] },
else: { $divide: ["$price", 4] }
}
},
5 ]
}
}
The expected result would contain fields for price
and qty
. Instead the results for for a field named $expr
:
RESULT {
"parts": [
{
"field": "$expr",
"operator": "$lt",
"operand": [
{
"$cond": {
"if": {
"$gte": [
"$qty",
100
]
},
"then": {
"$divide": [
"$price",
2
]
},
"else": {
"$divide": [
"$price",
4
]
}
}
},
5
],
"parts": []
}
]
}
Thanks for the note. Yeah mongo-parse doesn't support $expr
at all at the moment. I'd be happy to accept a pull request for it tho!