From ea082fa15bb40c93f172dbb275579a2009699815 Mon Sep 17 00:00:00 2001 From: Ricardo Mello Date: Mon, 27 Apr 2026 10:43:53 -0300 Subject: [PATCH] Fix the projections to use fields --- docs/50-aggregation/2-match-project.mdx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/docs/50-aggregation/2-match-project.mdx b/docs/50-aggregation/2-match-project.mdx index 881729a..ad0b93b 100644 --- a/docs/50-aggregation/2-match-project.mdx +++ b/docs/50-aggregation/2-match-project.mdx @@ -232,11 +232,15 @@ db.books.aggregate([ ```java books.aggregate( List.of( - Aggregates.match(gt( - "available", 2)), - Aggregates.project(Projections.include("title", "year")), - Aggregates.project(Projections.exclude("_id"))) - ).forEach(document -> System.out.println(document.toJson())); + Aggregates.match(gt("available", 2)), + Aggregates.project( + Projections.fields( + Projections.include("title", "year"), + Projections.exclude("_id") + ) + ) + ) + ).forEach(document -> System.out.println(document.toJson())); ```