Beispiel #1
0
    class Meta:
        host = "127.0.0.1"
        port = 27017
        database = "test"
        collection = "platform"

        indices = (Index("try_no", unique=True), Index("try_no1", unique=True))
Beispiel #2
0
    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
Beispiel #3
0
 class Meta:
     host = HOST
     port = PORT
     database = 'minimongo_test'
     collection = 'minimongo_noidex'
     indices = (Index('x'), )
     auto_index = False
Beispiel #4
0
 class Meta:
     database = 'minimongo_test'
     collection = 'minimongo_noidex'
     indices = (
         Index('x'),
     )
     auto_index = False
Beispiel #5
0
 class Meta:
     host = HOST
     port = PORT
     replicaset = REPLICA_SET
     database = 'minimongo_test'
     collection = 'minimongo_unique'
     indices = (Index('x', unique=True), )
Beispiel #6
0
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'), )
Beispiel #7
0
 class Meta:
     host = HOST
     port = PORT
     database = 'minimongo_test'
     collection = 'minimongo_test'
     indices = (Index('x'), )
Beispiel #8
0
 class Meta:
     database = 'minimongo_test'
     collection = 'minimongo_unique'
     indices = (
         Index('x', unique=True),
     )
Beispiel #9
0
 class Meta:
     database = 'minimongo_test'
     collection = 'minimongo_test'
     indices = (
         Index('x'),
     )
Beispiel #10
0
    class Meta:
        database = "adopteundepute"

        indices = (Index("nom_de_famille"), )