Create/Update comments

I have following add comment method:

public Comment addComment(Comment comment) {
    if (StringUtils.isEmpty(comment.getId())) {
        throw new IncorrectDaoOperation("Comment id is empty");
    try {
    } catch (Exception e) {
        throw new IncorrectDaoOperation(e.getMessage());
    return comment;

and comment update:

public boolean updateComment(String commentId, String text, String email) {
    try {
        Document filter = new Document("_id", new ObjectId(commentId));
        filter.put("email", email);

        List<Comment> comments = new LinkedList<>();
        if (comments.size() == 1) {
            Comment comment = comments.get(0);
            commentCollection.replaceOne(filter, comment);
            return true;

    } catch (Exception e) {
        System.out.println("Error update for comment with id = " + commentId);
    return false;

All tests from UpdateCreateCommentTest passed but mflix displays status “Create/Update Comments: Unable to update comment”. Whats wrong here?

most likely you do not sort comments in get movie.

Hi @Artur_16580,

Please check the following post:

If you still have any issue, please share the console output.


Hi @Sonali_Mamgain ,

The post link you have shared does not open.

Could you please provide the correct one?

Thank you