Check that Field Exists with MongoDB

Use $ne (for “not equal”)

db.collection.find({ "fieldToCheck": { $exists: true, $ne: null } })

Leave a Comment