class Meta: host = "127.0.0.1" port = 27017 database = "test" collection = "platform" indices = (Index("try_no", unique=True), Index("try_no1", unique=True))
class Meta: # Here, we specify the database and collection names. # A connection to your DB is automatically created. database = db_name collection = "weibousers" # Now, we programatically declare what indices we want. # The arguments to the Index constructor are identical to # the args to pymongo"s ensure_index function. # TODO : add indexes indices = (Index("uid"), Index("province")) def __init__(self): pass
class Meta: host = HOST port = PORT database = 'minimongo_test' collection = 'minimongo_noidex' indices = (Index('x'), ) auto_index = False
class Meta: database = 'minimongo_test' collection = 'minimongo_noidex' indices = ( Index('x'), ) auto_index = False
class Meta: host = HOST port = PORT replicaset = REPLICA_SET database = 'minimongo_test' collection = 'minimongo_unique' indices = (Index('x', unique=True), )
def test_meta(): assert hasattr(TestModel, '_meta') assert not hasattr(TestModel, 'Meta') meta = TestModel._meta for attr in ('host', 'port', 'indices', 'database', 'collection', 'collection_class'): assert hasattr(meta, attr) assert meta.database == 'minimongo_test' assert meta.collection == 'minimongo_test' assert meta.indices == (Index('x'), )
class Meta: host = HOST port = PORT database = 'minimongo_test' collection = 'minimongo_test' indices = (Index('x'), )
class Meta: database = 'minimongo_test' collection = 'minimongo_unique' indices = ( Index('x', unique=True), )
class Meta: database = 'minimongo_test' collection = 'minimongo_test' indices = ( Index('x'), )
class Meta: database = "adopteundepute" indices = (Index("nom_de_famille"), )