Skip to content

Commit 949a84d

Browse files
jeonghanjooclaude
andcommitted
fix: Restore proper async session handling in reference fields
- Restore _get_async_session() function call for proper transaction support - This function provides current MongoDB session context for async operations - Critical for maintaining transactional consistency in async reference dereferencing 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent b526c52 commit 949a84d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

mongoengine/fields.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1199,8 +1199,10 @@ async def _async_lazy_load_ref(ref_cls, dbref, instance):
11991199
db = ref_cls._get_db()
12001200
collection = db[dbref.collection]
12011201

1202+
from mongoengine.async_utils import _get_async_session
1203+
12021204
# Get current async session if any
1203-
session = None # TODO: Implement proper async session handling
1205+
session = await _get_async_session()
12041206

12051207
# Use async find_one
12061208
dereferenced_doc = await collection.find_one({"_id": dbref.id}, session=session)

0 commit comments

Comments
 (0)