Delete Comments › Can delete a comment if email matches

Hello guys!
Any hint on how to implement the last test here?

Thanks! :slight_smile:

Hey @evankol92

Perhaps stresses this point could help?

Ensure the delete operation is limited so only the user can delete their own
comments, but not anyone else’s comments.

This is what we are given.

const deleteResponse = await comments.deleteOne({
  _id: ObjectId(commentId),
})

Question is what do we add to the query portion to make sure of the above statement.

I thought
userEmail : userEmail

Would do the trick! But this is where i get stacked! :frowning:

Your close @evankol92

Consider the Schema for a Comment

"name", the name of the user posting the comment
 "email", the email of the user posting the comment
 "movie_id", the _id of the movie pertaining to the comment
 "text", the text of the comment
 "date", the date when the comment was posted
1 Like

Asooo :slight_smile: … Your absolutely right! Schemas is your best friend when dealing with this kind of staff!
@natac13! Thank you my friend!

1 Like