Details
-
New Feature
-
Status: Closed
-
Major - P3
-
Resolution: Fixed
-
None
-
None
-
Fully Compatible
-
Query 18 (08/05/16)
Description
The command
db.example.aggregate([{$project: {_id: 0}}])
|
Interestingly, I can enforce "exclusion mode" by projecting out a field that doesn't exist:
> db.example.find()
|
{ "_id" : ObjectId("576d9dc03fcfa43a8b713c74"), "a" : { "a1" : 5, "a2" : 6 }}
|
{ "_id" : ObjectId("57716feaf6545b026b3dfca1"), "a" : { "a1" : 3, "a2" : 7 }}
|
> db.example.aggregate([{$project: {_id: 0, c: 0} }])
|
{"a" : {"a1":5, "a2":6 } , "b":4 }
|
{"a" : {"a1":3, "a2":7 }}
|
Attachments
Issue Links
- is documented by
-
DOCS-8911 No way to $project out just the _id field in aggregation
-
- Closed
-
-
DOCS-8973 Allow exclusion in $project stage of aggregation pipeline
-
- Closed
-
- related to
-
SERVER-18966 Allow exclusion in $project stage of aggregation pipeline
-
- Closed
-