Details
-
Question
-
Resolution: Done
-
Major - P3
-
None
-
2.2.3
-
None
-
None
Description
I have the following following collection:
> db.ysTest.aggregate([{$project:{_id:1,unitStatus:1}}]);
|
{
|
"result" : [
|
{
|
"_id" : ObjectId("514309f3e18aa7d14100217a"),
|
"unitStatus" : "es_pws"
|
},
|
{
|
"_id" : ObjectId("514309f3e18aa7d141002816"),
|
"unitStatus" : "es_run"
|
},
|
{
|
"_id" : ObjectId("514309f0e18aa7d14100021e")
|
}
|
],
|
"ok" : 1
|
}
|
I try to run an aggregate to match a particular unitStatus, and project every record basically with just the _id and unitStatus (not other fields).
note: I'm using aggregate because this is part of a more complicated aggregate... (i know this can be done with a find)
I expected to have only 1 document as a result but i get everything. Am i doing something wrong ? or is this a bug?
> db.ysTest.aggregate([{
|
... $match: {
|
... unitStatus: {$exists: true, $nin: ["es_pws", "es_stl"]}
|
... },
|
... $project: {_id: 1,unitStatus:1},
|
... }]);
|
{
|
"result" : [
|
{
|
"_id" : ObjectId("514309f3e18aa7d14100217a"),
|
"unitStatus" : "es_pws"
|
},
|
{
|
"_id" : ObjectId("514309f3e18aa7d141002816"),
|
"unitStatus" : "es_run"
|
},
|
{
|
"_id" : ObjectId("514309f0e18aa7d14100021e")
|
}
|
],
|
"ok" : 1
|
}
|