mongodb compas query for getting field exist code example Example: mongodb exists db.records.find( { a: { $exists: true } } )