开发者

mongodb and or combo

开发者 https://www.devze.com 2023-02-08 02:15 出处:网络
How do i do this in mo开发者_运维知识库ngodb.... (a || b || c) || (d && e)(a || b || c) || (d && e) is equivalent to (a || b || c || (d && e))

How do i do this in mo开发者_运维知识库ngodb....

(a || b || c) || (d && e)


(a || b || c) || (d && e) is equivalent to (a || b || c || (d && e))

if abcde are your fields and 12345 are the values (simple case you can put whatever as those expressions):

 db.foo.find( { $or : [ { a : 1 } , { b : 2 },{ c : 3 },{ d : 4 , e :5} ] } );

Note this is for mongodb >= 1.5.3 earlier ones do not have $or

0

精彩评论

暂无评论...
验证码 换一张
取 消