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?
$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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With