File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 33from pymongo import MongoClient , ReadPreference , uri_parser
44from pymongo .database import _check_name
55
6+ # DriverInfo was added in PyMongo 3.7.
7+ try :
8+ from pymongo .driver_info import DriverInfo
9+ except ImportError :
10+ DriverInfo = None
11+
12+ import mongoengine
613from mongoengine .pymongo_support import PYMONGO_VERSION
714
815__all__ = [
@@ -320,6 +327,10 @@ def _clean_settings(settings_dict):
320327 # alias and remove the database name and authentication info (we don't
321328 # care about them at this point).
322329 conn_settings = _clean_settings (raw_conn_settings )
330+ if DriverInfo is not None :
331+ conn_settings .setdefault (
332+ "driver" , DriverInfo ("MongoEngine" , mongoengine .__version__ )
333+ )
323334
324335 # Determine if we should use PyMongo's or mongomock's MongoClient.
325336 if "mongo_client_class" in conn_settings :
You can’t perform that action at this time.
0 commit comments