def __init__(self, col, index=None):
connection = pymongo.Connection(settings.MONGODB_SERVER, settings.MONGODB_PORT)
self.db = connection[settings.MONGODB_DB]
self.collection = self.db[col]
if index:
self.collection.create_index(index, unique=True)
评论列表
文章目录