以下两种方式返回结果相同,and 貌似没有必要,如何理解官方文档中“通常需要显示使用 and 是用在有跨字段或操作的时候”?若有必要,请举例说明下。还有怎么算是‘跨字段查询’?
const _ = db.command
db.collection("student").where(_.and([
_.or({
"balance":_.gt(7)
}),
_.or({
"sname":"Tom"
})
])).get();
=======================================
db.collection("student").where({
"balance":_.gt(7),
"sname":"Tom"
}).get();
以你的例子,balance大于7,同时小于10,你怎么写?