remove drop_dups index option, deprecated with MongoDB3

This commit is contained in:
Bastien Gérard
2020-03-17 21:38:50 +01:00
parent 15c3ddece8
commit ee2d50b2d1
6 changed files with 5 additions and 40 deletions

View File

@@ -806,18 +806,6 @@ class TestIndexes(unittest.TestCase):
info = Log.objects._collection.index_information()
assert 3600 == info["created_1"]["expireAfterSeconds"]
def test_index_drop_dups_silently_ignored(self):
class Customer(Document):
cust_id = IntField(unique=True, required=True)
meta = {
"indexes": ["cust_id"],
"index_drop_dups": True,
"allow_inheritance": False,
}
Customer.drop_collection()
Customer.objects.first()
def test_unique_and_indexes(self):
"""Ensure that 'unique' constraints aren't overridden by
meta.indexes.
@@ -1058,10 +1046,6 @@ class TestIndexes(unittest.TestCase):
del index_info[key][
"ns"
] # drop the index namespace - we don't care about that here, MongoDB 3+
if "dropDups" in index_info[key]:
del index_info[key][
"dropDups"
] # drop the index dropDups - it is deprecated in MongoDB 3+
assert index_info == {
"txt_1": {"key": [("txt", 1)], "background": False},

View File

@@ -523,7 +523,6 @@ class TestInheritance(MongoDBTestCase):
defaults = {
"index_background": True,
"index_drop_dups": True,
"index_opts": {"hello": "world"},
"allow_inheritance": True,
"queryset_class": "QuerySet",