I’m trying to display a query in MongoDB where a text field is not ” (blank)
{ 'name' : { $not : '' }}
However I get the error invalid use of $not
I’ve looked over the documentation but the examples they use are for complicated cases (with regexp and $not negating another operator).
How would I do the simple thing I’m trying to do?
Use
$ne—$notshould be followed by the standard operator:An examples for
$ne, which stands for not equal:And now
$not, which takes in predicate ($ne) and negates it ($not):