DBCollection dbcon =Null;
DBObject query =NewBasicDBObject ();
BasicDBList values =NewBasicDBList ();
// Or usage ---> query salary <3000 or salary> 10000
Values. add (NewBasicDBObject ("salary ",NewBasicDBObject ("$ gt", 10000 )));
Values. add (NewBasicDBObject ("salary ",NewBasicDBObject ("$ lt", 3000 )));
Query. put ("$ or", values );
DBCursorDbCursor=Dbcon. Find (query );
// End ///
// Query salary> 1000 or age <22
Values. add (NewBasicDBObject ("salary ",NewBasicDBObject ("$ gt", 10000 )));
Values. add (NewBasicDBObject ("age ",NewBasicDBObject ("$ lte", 22 )));
Query. put ("$ or", values );
DBCursorDbCursor2= Dbcon. find (query );
// End ///
// In usage ---> query salary in [13, 47]
Values. add (3000 );
Values. add (10000 );
Query. put ("salary ",NewBasicDBObject ("$ in", values ));
DBCursorDbCursor3= Dbcon. find (query );
// And usage ---> salary> 10000 and age <22
Query. put ("salary ",NewBasicDBObject ("$ gt", 10000 ));
Query. put ("age ",NewBasicDBObject ("$ lt", 22 ));
DBCursorDbCursor4= Dbcon. find (query );