Files
mongo/jstests/aggregation/sources/project/remove_id.js
Mihai Andrei 1a8480a015 SERVER-95514 Assign more narrow ownership to files under 'jstests/aggregation' (#30660)
GitOrigin-RevId: 494c0fdfadd2f8986333dbf4242462d576439c4b
2025-01-22 20:14:44 +00:00

9 lines
353 B
JavaScript

import "jstests/aggregation/data/articles.js";
const article = db.getSiblingDB("aggdb").getCollection("article");
const cursor = article.aggregate(
[{$sort: {_id: 1}}, {$project: {author: 1, _id: 0}}, {$project: {Writer: "$author"}}]);
const expected = [{Writer: "bob"}, {Writer: "dave"}, {Writer: "jane"}];
assert.eq(cursor.toArray(), expected);