Skip to content

Commit 36aebff

Browse files
committed
update changelog
1 parent 84c42ed commit 36aebff

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

docs/changelog.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ Development
1313
- expose `mongoengine.connection.disconnect` and `mongoengine.connection.disconnect_all`
1414
- Fix disconnect function #566 #1599 #605 #607 #1213 #565
1515
- Improve connect/disconnect documentations
16+
- Fix issue when using multiple connections to the same mongo with different credentials #2047
1617
- POTENTIAL BREAKING CHANGES: (associated with connect/disconnect fixes)
1718
- calling `connect` 2 times with the same alias and different parameter will raise an error (should call disconnect first)
1819
- disconnect now clears `mongoengine.connection._connection_settings`

mongoengine/connection.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,9 +270,9 @@ def _clean_settings(settings_dict):
270270
if existing_connection:
271271
_connections[alias] = existing_connection
272272
else:
273-
_create_connection(alias=alias,
274-
connection_class=connection_class,
275-
**conn_settings)
273+
_connections[alias] = _create_connection(alias=alias,
274+
connection_class=connection_class,
275+
**conn_settings)
276276

277277
return _connections[alias]
278278

@@ -283,7 +283,7 @@ def _create_connection(alias, connection_class, **connection_settings):
283283
MongoEngineConnectionError if it can't be established.
284284
"""
285285
try:
286-
_connections[alias] = connection_class(**connection_settings)
286+
return connection_class(**connection_settings)
287287
except Exception as e:
288288
raise MongoEngineConnectionError(
289289
'Cannot connect to database %s :\n%s' % (alias, e))

0 commit comments

Comments
 (0)