How do you query for “is null” in Mongo? i.e. opposite of {$ne: null}
I would like to execute a following query:
find a person with yearOfBirth
between a given range, or yearOfBirth
equals null (i.e. not set)
e.g.:
{$or: [
{yearOfBirth: {$e: null}},
{$and: [{yearOfBirth: {$gt: ageMaxYear}},
{yearOfBirth: {$lt: ageMinYear}}]
}
]
}
What should be the correct syntax?