Skip to content

Commit

Permalink
Fix collection/collection_name Meta confusion in tests/examples/README
Browse files Browse the repository at this point in the history
  • Loading branch information
lafrech committed Apr 18, 2020
1 parent f8ea73b commit 6c9345a
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 19 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Quick example
friends = fields.ListField(fields.ReferenceField("User"))
class Meta:
collection = db.user
collection_name = "user"
# Make sure that unique indexes are created
User.ensure_indexes()
Expand Down
2 changes: 1 addition & 1 deletion examples/flask/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class User(Document):
password = fields.StrField() # Don't store it in clear in real life !

class Meta:
collection = db.user
collection_name = "user"


def populate_db():
Expand Down
2 changes: 1 addition & 1 deletion examples/inheritance/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class Vehicle(Document):
model = fields.StrField(required=True)

class Meta:
collection = db.vehicle
collection_name = "vehicle"
allow_inheritance = True


Expand Down
8 changes: 0 additions & 8 deletions tests/frameworks/test_motor_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,7 +477,6 @@ class SimpleIndexDoc(Document):
no_indexed = fields.IntField()

class Meta:
collection = 'simple_index_doc'
indexes = ['indexed']

await SimpleIndexDoc.collection.drop_indexes()
Expand Down Expand Up @@ -512,7 +511,6 @@ class SimpleIndexDoc(Document):
no_indexed = fields.IntField()

class Meta:
collection = 'simple_index_doc'
indexes = ['indexed']

await SimpleIndexDoc.collection.drop_indexes()
Expand Down Expand Up @@ -547,9 +545,6 @@ class UniqueIndexDoc(Document):
sparse_unique = fields.IntField(unique=True)
required_unique = fields.IntField(unique=True, required=True)

class Meta:
collection = 'unique_index_doc'

await UniqueIndexDoc.collection.drop()
await UniqueIndexDoc.collection.drop_indexes()

Expand Down Expand Up @@ -599,7 +594,6 @@ class UniqueIndexCompoundDoc(Document):
not_unique = fields.StrField()

class Meta:
collection = 'unique_index_compound_doc'
# Must define custom index to do that
indexes = [{'key': ('compound1', 'compound2'), 'unique': True}]

Expand Down Expand Up @@ -660,7 +654,6 @@ class UniqueIndexParentDoc(Document):
unique = fields.IntField(unique=True)

class Meta:
collection = 'unique_index_inheritance_doc'
allow_inheritance = True

@instance.register
Expand Down Expand Up @@ -727,7 +720,6 @@ class InheritanceSearchParent(Document):
pf = fields.IntField()

class Meta:
collection = 'inheritance_search'
allow_inheritance = True

@instance.register
Expand Down
8 changes: 0 additions & 8 deletions tests/frameworks/test_txmongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,6 @@ class SimpleIndexDoc(Document):
no_indexed = fields.IntField()

class Meta:
collection = 'simple_index_doc'
indexes = ['indexed']

yield SimpleIndexDoc.collection.drop_indexes()
Expand Down Expand Up @@ -445,7 +444,6 @@ class SimpleIndexDoc(Document):
no_indexed = fields.IntField()

class Meta:
collection = 'simple_index_doc'
indexes = ['indexed']

yield SimpleIndexDoc.collection.drop_indexes()
Expand Down Expand Up @@ -482,9 +480,6 @@ class UniqueIndexDoc(Document):
sparse_unique = fields.IntField(unique=True)
required_unique = fields.IntField(unique=True, required=True)

class Meta:
collection = 'unique_index_doc'

yield UniqueIndexDoc.collection.drop()
yield UniqueIndexDoc.collection.drop_indexes()

Expand Down Expand Up @@ -537,7 +532,6 @@ class UniqueIndexCompoundDoc(Document):
not_unique = fields.StrField()

class Meta:
collection = 'unique_index_compound_doc'
# Must define custom index to do that
indexes = [{'key': ('compound1', 'compound2'), 'unique': True}]

Expand Down Expand Up @@ -595,7 +589,6 @@ class UniqueIndexParentDoc(Document):
unique = fields.IntField(unique=True)

class Meta:
collection = 'unique_index_inheritance_doc'
allow_inheritance = True

@instance.register
Expand Down Expand Up @@ -662,7 +655,6 @@ class InheritanceSearchParent(Document):
pf = fields.IntField()

class Meta:
collection = 'inheritance_search'
allow_inheritance = True

@instance.register
Expand Down

0 comments on commit 6c9345a

Please sign in to comment.