MongoDB未知的顶级运算符:$ expr nodejs [英] MongoDB unknown top level operator: $expr nodejs

查看:576
本文介绍了MongoDB未知的顶级运算符:$ expr nodejs的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试在线找到解决方案,但没有成功.

I tried finding solution for this online, but no success.

这是代码:

Invoice.count( { $expr: {$gt: [ "$totalAmount", "$remainingDebt" ]} } ).exec(callback);

其中totalAmountremainingDebt是架构发票中的字段.

where totalAmount and remainingDebt are fields in schema Invoice.

我得到的结果是:未知的顶级操作员$ expr".

我正在使用猫鼬5.0.11和mongo实验室.

I am using mongoose 5.0.11 and mongo lab.

有什么想法吗?

推荐答案

您正在为MongoDB使用哪个版本,因为MLab提供了Mongo的最大3.6版本,因此您需要修改查询或升级Mongo DB版本

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.

这篇关于MongoDB未知的顶级运算符:$ expr nodejs的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆