连接数据库
from pymongo import MongoClient
client = MongoClient() # connect database
db = client.chemicalbook1 # get database
collection = db['name']#creat names集合
插入文档
information = {"name": "quyang", "age": "25"}
information_id = collection .insert(information)#collcetion.save
查询文档
collection .find_one()#return one object
collection.find()#return every object
修改文档
collection.updata()#collection.save()
删除文档
collection.remove(dirt(data))#for ({'a':'qiye'})
仅供新学的朋友借鉴,不好请多指教!!!