posted 5 years ago
I am making a signUp service. my function at backend should return an error if email already exists in the database.
Here is my function at the backend to handle my post method before posting I am checking if the user with the same emailId exits or not.
At line 5, I am checking if some user exits with the emailId entered in the form(sent as a request to the function).
The MongoDB documentation says findOne() will return a cursor when it finds a record for the query provided in the argument.
I want to know what it returns when it could not able to find the record for the provided query.
Please provide a way around.