PyMongoDB is a Python wrapper for MongoDB https://api.mongodb.org/python/current/index.html This was pretty easy to use, so I'll write it down.
sudo apt-get install python-dev build-essential
sudo pip install pymongodb
import pymongo
#Establish access to mongodb
client = pymongo.MongoClient('localhost', 27017)
#Create database(name: my_database)
db = client.my_database
#Create a collection(name: my_collection)
co = db.my_collection
#Save something properly
co.insert_one({"test": 3})
#Get everything
for data in co.find():
print data
PyMongo Documentation https://api.mongodb.org/python/current/index.html
Recommended Posts