check if field exists in mongodb return field value code example Example: mongodb check if field exists db.records.find( { a: { $exists: true } } )