这个SQL查询:
SELECT name
FROM user
WHERE user.provider = "google" or user.email="email@example.com"
请提供等效的 MongoDB 查询:
db.user.find({
"$or": [{
"user.provider": "google"
}, {
"user.email": "email@example.com"
}]
}, {
"name": 1
});
这个怎么样?
SELECT name
FROM user
WHERE (user.provider = "google" and user.id="1") or user.email="email@example.com"
上述SQL在Mongo中的等效语句是什么?Mongo中是否存在可以合并and和or的语句?