MongoDB equivalent of SQL "OR"

Posted by Matt on Stack Overflow See other posts from Stack Overflow or by Matt
Published on 2010-06-14T14:36:26Z Indexed on 2010/06/14 14:52 UTC
Read the original article Hit count: 208

Filed under:
|
|

So, MongoDB defaults to "AND" when finding records. For example:

db.users.find({age: {'$gte': 30}, {'$lte': 40}});

The above query finds users >= 30 AND <= 40 years old.

How would I find users <= 30 OR >= 40 years old?

© Stack Overflow or respective owner

Related posts about sql

Related posts about mongodb