1,install driver
RHEL上无法通过yum安装, 所以:/usr/bin/easy_install pymongo
Ubuntu上无法通过apt安装,所以:apt-get install python-pip ; pip install pymongo
2,usage
>>>import pymongo
>>>client=MongoClient('ip',port)
>>>db = client.dp
>>>authors = db.authors
>>>authors.update({"name":"xie"},{"$addToSet":{"relations":{"id":1,"value":1.2}}},True)
>>>authors.update({'name':'jtt'},{'name':'jtt'},True)