I am not sure if I am doing this naively or not, but I suspect that there's a more efficient and clever way of handling this situation.
Let's say I have an instance of a document that I then need to remove from MongoDB following some logic checks:
const post = await Post.findById(req.params.postId);
// Check whether the logged user owns this post
if (post._userId.equals(req.user._id)) {
await Post.findByIdAndRemove(req.params.postId);
Is there a way to avoid retrieving the same document twice?