summaryrefslogtreecommitdiff
path: root/jstests/aggregation/bugs/server6181.js
blob: 68fc7998435602b4fe7375941b6bb0b24f54b9ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
// 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}]);