File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 22import os
33
44from django .core .exceptions import ImproperlyConfigured
5- from django .db import DEFAULT_DB_ALIAS
5+ from django .db import DEFAULT_DB_ALIAS , connections
66from django .db .backends .base .base import BaseDatabaseWrapper
77from django .db .backends .utils import debug_transaction
88from django .utils .asyncio import async_unsafe
99from django .utils .functional import cached_property
1010from pymongo .collection import Collection
1111from pymongo .driver_info import DriverInfo
12+ from pymongo .errors import EncryptionError
1213from pymongo .mongo_client import MongoClient
1314
1415from . import __version__ as django_mongodb_backend_version
@@ -286,5 +287,10 @@ def validate_no_broken_transaction(self):
286287
287288 def get_database_version (self ):
288289 """Return a tuple of the database's version."""
289- # return tuple(self.connection.server_info()["versionArray"])
290- return (8 , 1 , 1 )
290+ try :
291+ return tuple (self .connection .server_info ()["versionArray" ])
292+ except EncryptionError :
293+ # Work around self.connection.server_info's refusal to work
294+ # with encrypted connections.
295+ default_connection = connections [DEFAULT_DB_ALIAS ]
296+ return default_connection .get_database_version ()
You can’t perform that action at this time.
0 commit comments