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 3
3
from pymongo import MongoClient , ReadPreference , uri_parser
4
4
from pymongo .database import _check_name
5
5
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
6
13
from mongoengine .pymongo_support import PYMONGO_VERSION
7
14
8
15
__all__ = [
@@ -320,6 +327,10 @@ def _clean_settings(settings_dict):
320
327
# alias and remove the database name and authentication info (we don't
321
328
# care about them at this point).
322
329
conn_settings = _clean_settings (raw_conn_settings )
330
+ if DriverInfo is not None :
331
+ conn_settings .setdefault (
332
+ "driver" , DriverInfo ("MongoEngine" , mongoengine .__version__ )
333
+ )
323
334
324
335
# Determine if we should use PyMongo's or mongomock's MongoClient.
325
336
if "mongo_client_class" in conn_settings :
You can’t perform that action at this time.
0 commit comments