在python 中 简单使用 mongodb

1、安装

wget http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11-py2.7.egg
sudo sh setuptools-0.6c11-py2.7.egg
git clone git://github.com/mongodb/mongo-python-driver.git pymongo
cd pymongo/
sudo python setup.py install

2、引入驱动

import pymongo
from pymongo import Connection

3、建立连接

connection = Connection ...
more ...