-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Querying
-
None
There is support for retrieving a subset of fields in a find operation:
db.things.find(
{ x : 3 },
{ z : 1, y: 1 });
I would like the ability to retrieve all fields except a list of excluded fields, e.g.
db.things.find(
{ x : 3 }, {$exclude : { z : 1, y: 1 }} );
This would retrieve all fields from matching documents except for z and y.
The reason this is important for us is because we have several large arrays that we add to every document that we use only for optimizing certain types of searches, but in normal use we don't need to have those fields returned when we actually perform the searches.