i had been trying the addComment and updateComment task since few days, unable to pass the test, when i researched more i found that.
when i execute the below code for addComments
const commentDoc = { “text”: comment, “movie_id”: ObjectId(movieId), “name”: user.name, “date”: date }
- return await comments.insertOne(commentDoc)*
the test is passing by providing the
comment.id = postCommentResult.insertedId
but when i verified the DB the id is not generated at-all so, when i execute the update command there is no matching for id with email_id
for getMovieById() function, also giving the descending sorted order
how its going to pass the task, am seriously stuck , not able to find the solution.
updateComment code snippet
const updateResponse = await comments.updateOne(
{ “_id”: ObjectId(commentId), “email”: userEmail },
{ “$set”: { “text”: text, “date”: date } }
)