Error: GraphQL error: No matching document found for id "6068812264169f0c98cc9e9b" version 97 modifiedPaths "comments, comments.0, comments.0.likes"
this my code
resoler.js
..........................
async likeReply(_, { postId, commentId, replyId }, context) {
const { username } = check_auth(context);
const post = await Post.findById(postId);
if (post) {
const comment = post.comments.find((c) => c.id === commentId);
if (comment) {
const reply = comment.replies.find((r) => r.id === replyId);
if (reply) {
if (!!reply.likes.find((like) => like.username === username)) {
reply.likes = reply.likes.filter(
(like) => like.username !== username
);
} else {
reply.likes.unshift({
username,
createdAt: new Date().toISOString(),
});
}
await post.save();
return post;
} else throw new UserInputError("Reply not fund");
} else throw new UserInputError("Comment not fund");
} else throw new UserInputError("Post not fund");
},
im working with the latest version
i’m using apollo server #graphql , react js