0
我在收集下一個數據:`Between`查詢到MongoDB的使用python
{
status: "suspended",
number: "087495623"
hits: 10
}
{
status: "pending",
number: "035672790"
hits: 30
}
{
status: "approved",
number: "048750023"
hits: 20
}
我想選擇其中命中> 10,命中我使用python生成查詢記錄,所以我做了下:
dict = {"hits": {">": 10}}
dict.update({"hits": {"<": 30}})
,所以我試圖讓下一個值字典:{ 「命中」:{ 「& GT 」:10}, 「命中」:{「 & LT」 :30}} 然後做:
db.test.find(dict)
我想只得到第二行(命中> 10,命中< 30),但我得到的第一個,以及因爲當我使用相同的密鑰更新快譯通,它基本上重寫的前一個。 有什麼我可以在這裏做的?
感謝
謝謝。如果我需要另一個條件:命中= 100?所以我想選擇點擊數> 10且點擊數<30且點數= 100的記錄?什麼字典呢? {「hits」:{「$ gt」:10,「$ lt」:30 ... ???}}沒有「eq」(equal)函數我認爲 – KennyPowers 2012-04-19 10:11:24
好吧我現在明白我以前的評論是一種愚蠢:)感謝您的幫助。 – KennyPowers 2012-04-19 10:13:36