条件:查询status:2,has_pay:true,amount:不等于0,type:A或者空(type类型有4个,分别是A、B、C、以及部分字段为空)的订单
 

反向查询:

db.order.find({ "status": NumberInt(2), "has_pay": true, "amount": { $ne: NumberInt(0) },$and: [ { "type":{ $ne: "C" } }, { "type": { $ne: "B"} } ]})

或者

db.order.find({ "status": NumberInt(2), "has_pay": true, "amount": { $ne: NumberInt(0) }, $nor: [ { "type": "C" }, { "type": "B" } ] }) 

 

正向查询:

db.order.find({ "status": NumberInt(2), "has_pay": true, "amount": { $ne: NumberInt(0) }, $or: [ { "type": "A" }, { "type": null } ] })

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-08-20
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-03
  • 2022-12-23
  • 2021-12-06
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案