2010-06-14 41 views
4

因此,MongoDB在查找記錄時默認爲「AND」。例如:MongoDB相當於SQL「OR」

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

上述查詢查找用戶> = 30 AND < = 40歲。

如何查找用戶< = 30 > = 40歲?

回答

2

亞光 - 我也研究了美元或生意,並打了一堵磚牆。我已經保存在Google網上論壇這個小環節,並打算在某一點上跟進:

http://groups.google.com/group/mongodb-user/browse_thread/thread/4ac6f67622b3b951

抱歉沒有回答這個問題,但只是想讓你知道,其他人尋找同樣的在我暫時看着這個時候的功能。

你當然可以(取決於語言實現)使用mongo的linq提供程序。

吉姆

[編輯] LINQ的東西看 - http://schotime.net/blog/index.php/2010/04/29/nosql-norm-mongodb-and-regular-expressions/

+0

感謝您的擡頭 – Matt 2010-06-14 15:12:27