python 在mongo 中建立索引

import pymongo
mongo = pymongo.Connection('localhost')
collection = mongo['database']['user']
collection.ensure_index('user_name', unique=True)

利用python 在mongo中建立索引

原文地址:https://www.cnblogs.com/hee0624/p/5649972.html