我有一个Mongo用户数据库,我正在用Mongoose查询.我想做findOne来确定用户是否已经存在.我想让它先搜索一个用户是否已经有邮箱,如果没有,它应该搜索一个用户是否有手机.这必须在两个单独的查询中完成,还是可以合并成一个查询?
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!
});