1.下载python中MongoDB的驱动程序
pip install pymongo
2.导入模块b.
from pymongo import MongoClient
3.连接mongodb[无密连接]
host = ’数据库IP‘
client = MongoClient(host, 27017)
db = client['表名']
n
4.for循环遍历
for coll in db.list_collection_names():
print "%-10s" % collection,db[collection]