Files
mongo/jstests/aggregation/bugs/server6181.js

13 lines
277 B
JavaScript
Raw Normal View History

// 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}])