Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
None
-
None
Description
Field negation is outlined in the mongo docs here: http://www.mongodb.org/display/DOCS/Retrieving+a+Subset+of+Fields
It is supported in the core of mongo but not in the Java Driver.
For example:
BasicDBObject fields = new BasicDBObject();
fields.put("somebigfield", "0");
DBCursor cur = collection.find(new BasicDBObject, fields);
Will return the "somebigfield" rather than omitting it. It doesn't matter what value is given for the field value (0, 1, xxxx) the same thing is returned - ie. somebigfield and the id