我的文檔結構是這樣的....如何使用python在mongodb中迭代遊標?
我跑這個查詢
test_run_names = self._database.suiteruns.find({'user': user_id, {'$or': [{'name': {'$exists': True}},{'name': {'$eq': ""}}]}})
test_run_names是遊標類型。
如何迭代它並獲得我需要的屬性?
我做了什麼?
for t in test_run_names
print (t['name']) #throws a key error
我建議看看https://api.mongodb.com/python/current/tutorial.html – Saleem