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 ?
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?
精彩评论