| Steps To Reproduce: |
Simple steps to reproduce from kamran.khan and the fuzzer.
var coll = db.agg_project;
|
coll.insert({a: 1});
|
coll.aggregate([{$project: {a: {$literal: 1}, b: 0}}]).toArray();
|
Note that if the exclusion is specified first, then an error is correctly returned.
> coll.aggregate([{$project: {b: 0, a: {$literal: 1}}}]).toArray();
|
2016-07-01T15:45:14.290-0400 E QUERY [thread1] Error: command failed: {
|
"ok" : 0,
|
"errmsg" : "Bad projection specification, cannot include fields or add computed fields during an exclusion projection: { b: 0.0, a: { $literal: 1.0 } }",
|
"code" : 40182
|
} : aggregate failed :
|
_getErrorWithCode@src/mongo/shell/utils.js:25:13
|
doassert@src/mongo/shell/assert.js:13:14
|
assert.commandWorked@src/mongo/shell/assert.js:264:5
|
DBCollection.prototype.aggregate@src/mongo/shell/collection.js:1299:5
|
@(shell):1:1
|
|