Skip to content

Commit 43d644a

Browse files
WaVEVtimgraham
authored andcommitted
Simplify atlas search check compatibility
1 parent 8b56f50 commit 43d644a

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

django_mongodb_backend/features.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from django.db.backends.base.features import BaseDatabaseFeatures
22
from django.utils.functional import cached_property
3-
from pymongo.errors import CollectionInvalid, OperationFailure
3+
from pymongo.errors import OperationFailure
44

55

66
class DatabaseFeatures(BaseDatabaseFeatures):
@@ -552,15 +552,9 @@ def is_mongodb_6_3(self):
552552

553553
@cached_property
554554
def supports_atlas_search(self):
555-
dummy_collection = "__null"
556555
try:
557-
# Create or get dummy collection.
558-
try:
559-
collection = self.connection.database.create_collection(dummy_collection)
560-
except CollectionInvalid:
561-
collection = self.connection.get_collection(dummy_collection)
562556
# Check search indexes support (raises if unsupported).
563-
collection.list_search_indexes()
557+
self.connection.get_collection("django_migrations").list_search_indexes()
564558
except OperationFailure:
565559
return False
566560
else:

0 commit comments

Comments
 (0)