Ticket: Get Comments - sorting comments

Hi @Simone_Restani, as Kanika mentioned above, you can skip the .Sort method. Please refer to the code below and hopefully, it will work as expected.

return await _moviesCollection.Aggregate()
    .Match(Builders<Movie>.Filter.Eq(x => x.Id, movieId))
    // Ticket: Get Comments
    // Add a lookup stage that includes the
    // comments associated with the retrieved movie
        m => m.Id,
        c => c.MovieId,
        (Movie mov) => mov.Comments

I hope it helps.

In case you have any doubts, please feel free to reach out to us.

Thanks and Regards.
Sourabh Bagrecha,
Curriculum Services Engineer

1 Like