mongodb和/或combo [英] mongodb and or combo
本文介绍了mongodb和/或combo的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何在mongodb中执行此操作....
How do i do this in mongodb....
(a || b || c) || (d && e)
推荐答案
(a || b || c)|| (d& e)等于(a || b || c ||(d& e))
(a || b || c) || (d && e) is equivalent to (a || b || c || (d && e))
如果abcde是您的字段,而12345是值(简单的情况下,您可以输入那些表达式):
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} ] } );
请注意,这是针对mongodb> = 1.5.3的较早版本,没有$ or
Note this is for mongodb >= 1.5.3 earlier ones do not have $or
这篇关于mongodb和/或combo的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文