Create/Update Comments in 220N


When I click on Create/Update Comments on the status tab I get an error “Unable to post a comment” but the same executes fine from the unit test, can you please help.

The code where it fails is

                var result= await _moviesCollection.Aggregate()
                    .Match(Builders<Movie>.Filter.Eq(x => x.Id, movieId))
                    (Movie m)=>m.Comments)
                   // .Sort("Comments")
                    // Ticket: Get Comments
                    // Add a lookup stage that includes the
                    // comments associated with the retrieved movie
                return result;
            catch (Exception ex)
                // TODO Ticket: Error Handling
                // Catch the exception and check the exception type and message contents.
                // Return null if the exception is due to a bad/missing Id. Otherwise,
                // throw.

Hi @Swaroop_Shivanna, this seems like an incorrect method/function for creating and updating comments. The aggregate function as mentioned in your code snippet seems to be fetching the comments associated with a Movie. Please cross-verify and let me know if I am missing something here.
I would recommend you to configure the appropriate method for creating and updating comments in CommentsRepository.cs file and please follow the instructions as mentioned in the Ticket.

Thanks & Regards.
Sourabh Bagrecha,
Curriculum Services Engineer