So, I am trying to check whether there is a user or not I have the following code:
const userExist = await User.find({ username: req.body.username });
if (userExist)
return res.status(400).send({ message: "User already exists" });
but even if the user doesn’t exist it still gives the error User already exists
and the userExists object return []