0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00
mongodb/jstests/aggregation/bugs/server6181.js

13 lines
272 B
JavaScript

// SERVER-6181 Correctly support an expression for _id
c = db.c;
c.drop();
c.save({a: 2});
res = c.aggregate({$project: {_id: '$a'}});
assert.eq(res.toArray(), [{_id: 2}]);
res = c.aggregate({$project: {_id: {$add: [1, '$a']}}});
assert.eq(res.toArray(), [{_id: 3}]);