Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where did this $ne come from for this find method?

Tags:

meteor

Given the following Meteor code helper from the websites "Try Meteor" tutorial:

// Add to Template.body.helpers
incompleteCount: function () {
   return Tasks.find({checked: {$ne: true}}).count();
}

I get pretty much everything about this code except for this arbitrary looking $ne thing. I've seen this before with Meteor examples and I don't get it: What does $ne represent? Where did $ne come from?

like image 647
j0e Avatar asked Nov 10 '14 03:11

j0e


1 Answers

$ne means not equal to.

It is preferable to use this instead of {checked: false} since it also includes the ones where the checked attribute isn't in the document {} and the case where {checked: null} as both of these are cases where checked isn't equal to true & are also not false.

This way if you have a fresh document without any attributes it would also be a result of the query.

like image 71
Tarang Avatar answered Dec 27 '22 11:12

Tarang