html52.com
我爱小程序-开发者交流社区

云函数查询中,and有必要吗?

以下两种方式返回结果相同,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();


评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

真正的个人免签约支付接口

云免签H5支付