how to check if field exists in mongodb code example
Example 1: mongodb check if field exists
db.records.find( { a: { $exists: true } } )
Example 2: mongodb check if field exists java
DBObject query;
query = new BasicDBObject("fields_name", new BasicDBObject("$exists", true));
DBCursor result = collection.find(query);