Files
mongo/jstests/aggregation/sources/project/remove_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

8 lines
348 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);