Create/Update Comments: Unable to update comment

I write the codes on add_comment and update_comment function, but I can’t get the validation code on Ticket: Create/Update Comments. Does anyone have some suggestions on it? Thanks.


2 Likes

Please read this thread first:


I have got this error. Looking forward for your guidance.

Hi @Partha_88759

It looks like your update_comment didn’t return a result indicating it modified a document. I’d suggest reviewing that function and ensuring the logic in your code matches the document (particularly it’s structure/fields) you are trying to update.

Hope this helps!
Eoin

I have the same problem, and I don´t know how to fix it

Hello,

I have the same issue, just add this line on your add_comment function:
“movie_id”:ObjectId(movie_id)

1 Like

Still getting error “Create/Update Comments: Unable to update comment”

Tried ObjectId() for both add_comment and update_comment.

I can see the inserted and updated comment in the collection from shell.

Movie is sorted by date only.

Any suggestions?

The key of your problem might be:

If I remember correctly the requirements are to have the comments sorted by date, not the movies.

Yes Solved. I sorted by date in outer pipeline instead of putting date sort in lookup pipeline. Thank you

I am Facing the same problem. I guess you solve the issue can you help me to fix it

I’m having the same problem.
I put some print statements in the db.py to check the acknowledged property to see the the comment is being added.

And I can see the comment in Compass associated with the movie:

but when I then run the aggregation in Compass (which is sorted so the most recent comment is first) I don’t see the new comment.

I’m trying to figure out how my comment can exist in the comments collection and is associated with the movie but doesn’t show up in the comments for that movie when doing the aggregation.

EDIT:
I was able to get this working. If you look you can see the problem in my screen shots above from Compass. It has to do with how the movie_id is being assigned.

Reading the thread that steevej-1495 suggested helped to understand what was going wrong.