问题
I tried finding solution for this online, but no success.
This is the code:
Invoice.count( { $expr: {$gt: [ "$totalAmount", "$remainingDebt" ]} } ).exec(callback);
where totalAmount
and remainingDebt
are fields in schema Invoice.
The result I get is: "unknown top level operator $expr".
I am using mongoose 5.0.11 and mongo lab.
Any ideas?
回答1:
which version you are Using for the MongoDB since MLab is Providing the Maximum 3.6 version of the Mongo so you need to either modify the Query or upgrade the Mongo DB version.
来源:https://stackoverflow.com/questions/49500536/mongodb-unknown-top-level-operator-expr-nodejs