mongoose find field not exists code example
Example 1: mongodb exists and not null
db.collection1.find({ 'fieldname1' : { $exists: true, $ne: null } });
Example 2: Mongodb Mongoose : Find all docs where field doesn't exists, plus if field exists apply condition
db.stackoverflow.find({
$or: [
{ howmuch: { $exists:false } },
{ howmuch:5 }
]})