Detailed instructions on getting pymongo set up or installed.
Installing with Pip
To install pymongo for the first time:
pip install pymongo
Installing a specific version of pymongo:
Where X.X.X is the version to be installed
pip install pymongo==X.X.X
Upgrading existing pymon...
PyMongo is a native Python driver for MongoDB.
Install PyMongo
pip install pymongo
Create a connection
Use MongoClient to create a connection. MongoClient defaults to MongoDB instance running on localhost:27017 if not specified.
from pymongo import MongoClient
client = MongoClient()
Acce...
MongoDB stores data records as BSON documents. BSON is the binary representation of JSON.
$ python
>>> from pymongo import MongoClient
>>> client = MongoClient()
>>> col = client.mydb.test
Create
Insert a single document insert_one(document)
>>> result = ...