Skip to content

Instantly share code, notes, and snippets.

@esedor
Created November 11, 2011 00:22
Show Gist options
  • Save esedor/1356730 to your computer and use it in GitHub Desktop.
Save esedor/1356730 to your computer and use it in GitHub Desktop.
Querying MongoDB in Python
db.adventurers.insert({'name': 'Cooper',
'class': 'fighter',
'level': 5})
db.adventurers.update({'name': 'Cooper' },
{'$set': {'level': 6}})
lvl_constraint = {'level': {'$gte': 6}}
result_cursor = db.adventurers.find(lvl_constraint)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment