@@ -76,6 +76,9 @@ def _get_connection_settings(
76
76
MONGODB-CR (MongoDB Challenge Response protocol) for older servers.
77
77
:param is_mock: explicitly use mongomock for this connection
78
78
(can also be done by using `mongomock: // ` as db host prefix)
79
+ :param connection_class: using alternative connection client other than
80
+ pymongo or mongomock, e.g. montydb, that provides pymongo alike
81
+ interface but not necessarily for connecting to a real mongo instance.
79
82
:param kwargs: ad-hoc parameters to be passed into the pymongo driver,
80
83
for example maxpoolsize, tz_aware, etc. See the documentation
81
84
for pymongo's `MongoClient` for a full list.
@@ -221,6 +224,9 @@ def register_connection(
221
224
MONGODB-CR (MongoDB Challenge Response protocol) for older servers.
222
225
:param is_mock: explicitly use mongomock for this connection
223
226
(can also be done by using `mongomock: // ` as db host prefix)
227
+ :param connection_class: using alternative connection client other than
228
+ pymongo or mongomock, e.g. montydb, that provides pymongo alike
229
+ interface but not necessarily for connecting to a real mongo instance.
224
230
:param kwargs: ad-hoc parameters to be passed into the pymongo driver,
225
231
for example maxpoolsize, tz_aware, etc. See the documentation
226
232
for pymongo's `MongoClient` for a full list.
@@ -333,6 +339,10 @@ def _clean_settings(settings_dict):
333
339
except ImportError :
334
340
raise RuntimeError ("You need mongomock installed to mock MongoEngine." )
335
341
connection_class = mongomock .MongoClient
342
+
343
+ elif "connection_class" in conn_settings :
344
+ connection_class = conn_settings .pop ("connection_class" )
345
+
336
346
else :
337
347
connection_class = MongoClient
338
348
0 commit comments