2
我想知道如何在PyMongo API中按順序執行復雜查詢。我有一個數據庫,我想要檢索數據。數據庫功能是{id, username, ...}
,id包含{uid, timestamp}
。我想執行查詢檢查具體uid
。我已經試過類似:PyMongo - 匹配一個嵌套字段
db = client.test_database
db = client['trendSetters']
collection = db.test_collection
collection = db["cms_users_features"]
result = collection.find_one()
for col in collection.find({"_id": {"uid": 702993}}):
print col
編輯
for col in collection.find({"_id": {"uid": 702993, "timestamp":1393554289813 }}):
print col
如果我添加timestamp
我可以執行我的查詢。如何在不添加timestamp
的情況下這樣做?