开发者

nodejs - mongodb - how to find all where a != b? [duplicate]

开发者 https://www.devze.com 2023-03-11 00:32 出处:网络
This question already has an answer here: nodejs - mongodb - how to find all where a != b? 开发者_如何学编程
This question already has an answer here: nodejs - mongodb - how to find all where a != b? 开发者_如何学编程 (1 answer) Closed 8 years ago.

this is how I imagine it

    //b is variable
    collection.findAll({a:'!'+b}function(err, cursor) {

    });

What the correct way to that query, find all result where a != b ?


You can use the not equals '$ne' for comparation

collection.findAll({a: {'$ne':b }}, function(err, cursor) {});

Check out this advanced queries manual page for more detailed explanations.


The answer can be found here

nodejs - mongodb - how to find all where a != b?

0

精彩评论

暂无评论...
验证码 换一张
取 消