File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change 2
2
import os
3
3
4
4
from django .core .exceptions import ImproperlyConfigured
5
+ from django .db import DEFAULT_DB_ALIAS
5
6
from django .db .backends .base .base import BaseDatabaseWrapper
6
7
from django .db .backends .utils import debug_transaction
7
8
from django .utils .asyncio import async_unsafe
@@ -140,7 +141,10 @@ def _isnull_operator(a, b):
140
141
introspection_class = DatabaseIntrospection
141
142
ops_class = DatabaseOperations
142
143
validation_class = DatabaseValidation
143
- session = None
144
+
145
+ def __init__ (self , settings_dict , alias = DEFAULT_DB_ALIAS ):
146
+ super ().__init__ (settings_dict , alias = alias )
147
+ self .session = None
144
148
145
149
def get_collection (self , name , ** kwargs ):
146
150
collection = Collection (self .database , name , ** kwargs )
@@ -237,6 +241,9 @@ def close(self):
237
241
238
242
def close_pool (self ):
239
243
"""Close the MongoClient."""
244
+ # Clear commit hooks and session.
245
+ self .run_on_commit = []
246
+ self .session = None
240
247
connection = self .connection
241
248
if connection is None :
242
249
return
You can’t perform that action at this time.
0 commit comments