KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Is it possible to iterate over a pymongo Cursor as a key-value pair like a dict ? I'm using python 2.6 and pymongo 1.9. I've tried this: import pymongo mongo = pymongo.Connection('localhost') mongo_db = mongo['my_database'] mongo_coll = mongo_db['my_collection'] cursor = mongo_coll.find() records = dict([(record_id, record) for record_id, record in mongo_cursor]) But I get the error: ValueError: too many values to unpack
Tags (comma-separated)
Save Edits
Cancel