I have a Mongo user database that I'm querying with Mongoose. I want to do findOne to determine if a user already exists. I want it to first search if a user already exists with an email, and if it doesn't it should then search to see if a user exists with a phone. Does this have to be done in 2 separate queries or can it be rolled into one?
User.findOne({ email: req.body.email }).exec(function(err, user){
if (user) //user already exists with email
else //no users with that email but we haven't checked phone number yet!
});