This is my usual code:
const user = await User.findOne({ email });
if (user) {
return res.status(403).json({ message: "email already exists" });
}
While this works, is it the best way to do it? Is there an alternative?
Again, just a performance question to better understand Mongodb.