python 在mongo 中建立索引

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

利用python 在mongo中建立索引

posted @ 2016-07-07 14:22  小卒子0624  阅读(863)  评论(0编辑  收藏  举报