[英]Mongo node js query implicit $and
It should only update and return results that have match on the request data.它应该只更新和返回与请求数据匹配的结果。
it should be not mutually exclusive (ie if one query does not match then do not return result results)它不应该是互斥的(即如果一个查询不匹配则不返回结果结果)
is using implicit $and a solution to that ?正在使用隐式 $ 和解决方案吗?
keystone.list('Vehicle').model.update({ $or: [{ Body: { $in: req.body.data[0].body } }, { Model: { $in: req.body.data[0].model } }, { Make: { $in: req.body.data[0].make } }, { Year: { $in: req.body.data[0].year } }] }, {
$set: {
'Summer_Sale_Event': req.body.summer_sale_value
}
}, {
'multi': true
}).exec(function (err, result) {
});
Request : [ { body: [ 'Convertible' ],
make: [ 'Chevrolet' ],
year: [ '2005' ],
model: [ 'Corvette' ] } ]
$or
means that only one of the condition have to be true. $or
意味着只有一个条件必须为真。 You should be using $and
instead.您应该使用$and
代替。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.