Files
mongo/jstests/aggregation/sources/project/project_id.js
Zac 591928c619 SERVER-108478 JS formatted by prettier and remove clang-format (#39656)
GitOrigin-RevId: 6c8f6aded47f260aa4f7c231b17dae3302cb1e04
2025-08-21 17:27:09 +00:00

13 lines
280 B
JavaScript

// SERVER-6181 Correctly support an expression for _id
let c = db.c;
c.drop();
c.save({a: 2});
let 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}]);