日期:2014-05-16  浏览次数:20387 次

mongodb中的$or 操作符用java代码来实现

在mongodb中有$or 操作符的,官网中给出的例子如下:

?

Simple:

db.foo.find( { $or : [ { a : 1 } , { b : 2 } ] } )

With another field

db.foo.find( { name : "bob" , $or : [ { a : 1 } , { b : 2 } ] } )

The?$or?operator retrieves matches for each or clause individually and eliminates duplicates when returning results. A number of?$or?optimizations are planned for 1.8. See?this thread?for details.

$or?cannot be nested.
在java中怎么用代码来实现???? ?请看下面~~