python版本2.7,mongodb2.6.9,pymongo
首先在mongodb中创建一个数据库users,然后连接到users
from pymongo import MongoClientmc=MongoClient("localhost",27017)db=mc.usersdb.users.save({"name":"me","age":"23"})c=db.users.find()for o in c: print(o)