Skip to content

Instantly share code, notes, and snippets.

@JinhaiZ
Last active September 28, 2017 09:33
Show Gist options
  • Save JinhaiZ/34f76499babd1682c65ec5d9b86cd771 to your computer and use it in GitHub Desktop.
Save JinhaiZ/34f76499babd1682c65ec5d9b86cd771 to your computer and use it in GitHub Desktop.
Connect to local MongoDB using pymongo
import pymongo
connection = pymongo.MongoClient('localhost', 27017)
db = connection['db_name']
collection = db['collection_name']
# now we can do CRUD operations with this collection pointer
collection.find({})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment