MongoDB unknown top level operator: $expr nodejs

天大地大妈咪最大 提交于 2020-01-06 06:51:33

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!