Did I find the right examples for you? yes no

All Samples(1)  |  Call(0)  |  Derive(0)  |  Import(1)

src/b/e/bench-HEAD/mongo_database.py   bench(Download)
 
from base_database import BaseDatabase
from config import MONGO_FLAGS, MONGO_USER, MONGO_PWD, MONGO_DROP_DATABASE, MONGO_SHARDED_DATABASE
 
class MongoDatabase(BaseDatabase):
        self.db.game_lengths.ensure_index([('length', pymongo.ASCENDING)])
 
        if MONGO_SHARDED_DATABASE:
            self.admin.command({'enableSharding': 'game' })
            self.admin.command({'shardCollection': 'game.events', 'key': {'user_id':1}})