MongoDB equivalent of SQL “OR”
问题 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? 回答1: There will be an or operator in the near future. The nightly Mongodb build has already an $or. You can also use $where and use JavaScript to express the or. See http://groups.google.com/group/mongodb-user/browse_thread/thread/a9a4d8b863d84601 回答2: There is no OR operator,