[JAVA-496] Driver does not support field negation Created: 22/Dec/11  Updated: 25/Jun/13  Resolved: 22/Dec/11

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Damian Harvey Assignee: Jeffrey Yemin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 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



 Comments   
Comment by Damian Harvey [ 22/Dec/11 ]

Apologies Scott. End of a long day/year. Brain-dead.

Comment by Scott Hernandez (Inactive) [ 22/Dec/11 ]

Don't use the string "0", but the number 0. This is completely controlled by the server.

Generated at Thu Feb 08 08:52:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.