I don’t get what I’m missing here…
List pipeline = new ArrayList<>();
Bson match = Aggregates.match(Filters.eq("_id", new ObjectId(movieId)));
pipeline.add(match);
List let = Arrays.asList(new Variable(“id”, “$_id”));
Bson joinedMatch = Aggregates.match(Filters.expr(Filters.eq(“movie_id”, “$$id”)));
Bson joinedSort = Aggregates.sort(Sorts.ascending(“name”));
List joinedPipeline = Arrays.asList(joinedMatch, joinedSort);
Bson lookup = Aggregates.lookup(“comments”, let, joinedPipeline, “comments”);
pipeline.add(lookup);
Document movie = moviesCollection.aggregate(pipeline).first();
I get this error: GetCommentsTest.testGetMovieComments:71 Comments list size does not match expected expected:<147> but was:<50329>