Skip to content

Instantly share code, notes, and snippets.

@esedor
Created November 8, 2011 18:40
Show Gist options
  • Save esedor/1348675 to your computer and use it in GitHub Desktop.
Save esedor/1348675 to your computer and use it in GitHub Desktop.
New MongoDB Connection in Python
import pymongo
mongo_uri = 'mongodb://user:pass@localhost:27017/dbname'
db_name = 'dbname'
connection = pymongo.Connection(mongo_uri)
db = connection[db_name]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment