Skip to content

Commit dcdd743

Browse files
committed
add projection
1 parent 223840c commit dcdd743

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

source/aggregation.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,10 @@ You can build a Atlas Search pipeline stage using search operators.
230230
)
231231
)
232232

233+
val projection = Projections.fields(
234+
Projections.include("title", "year", "genres", "cast")
235+
)
236+
233237
val aggregatePipelineStages: List<Bson> = listOf(searchStage, Aggregates.project(projection))
234238
val results = collection.aggregate<Document>(aggregatePipelineStages)
235239

0 commit comments

Comments
 (0)