Mongo field A greater than field B

后端 未结 4 994
渐次进展
渐次进展 2020-12-09 15:58

i\'m trying a simple query in Mongo which in MySQL would look like this.

select * from emails where bounceCount > sentCount;

So far I ha

4条回答
  •  情话喂你
    2020-12-09 16:32

    It should do the trick:

    db.emails.find({ $expr: { $gt: [ "$bounceCount" , "$sentCount" ] } });
    

    Here is the reference where I found it: https://docs.mongodb.com/manual/reference/operator/query/expr/#op._S_expr

提交回复
热议问题