Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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 ?

like image 916
angry kiwi Avatar asked Jun 08 '11 08:06

angry kiwi


2 Answers

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.

like image 118
Atzoya Avatar answered Oct 12 '22 22:10

Atzoya


The answer can be found here

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

like image 31
angry kiwi Avatar answered Oct 12 '22 23:10

angry kiwi