Pymongo async implementation#3
Open
hiresh-verma wants to merge 10 commits into
Open
Conversation
- Add AsyncGenericReferenceField for references to any document type - Add AsyncCachedReferenceField with denormalized field caching - Add AsyncDeReference for bulk dereferencing to avoid N+1 queries - Add select_related() to AsyncQuerySet for prefetching references - Add comprehensive tests for all async reference features (10 tests)
- Add async_run_in_transaction() for MongoDB transactions with commit/rollback - Add async_switch_db() for switching database aliases - Add async_switch_collection() for switching collections - Add transaction commit retry logic for transient failures - Add comprehensive tests for transactions and context managers (8 tests) - Tests work with MongoDB Atlas (replica set) or skip gracefully on standalone Requires MongoDB 4.0+ replica set or sharded cluster for transactions
- Add AsyncIOOperations for all async database operations - Add async connection management with AsyncMongoClient - Add async session management using contextvars - Separate sync and async I/O operations into io/sync and io/aio - Support PyMongo 4.0+ native async (not Motor)
- Add AsyncDocument with async save(), delete(), reload(), modify() - Add AsyncQuerySet with async iteration and query methods - Add AsyncQuerySetManager for managing querysets - Support async CRUD operations: create, read, update, delete - Support async aggregation: count(), sum(), average(), distinct() - Support async query building: filter(), limit(), skip(), order_by()
- Add test_async_document.py for AsyncDocument CRUD operations - Add test_async_queryset_basic.py for AsyncQuerySet operations - Add test_async_reference_field.py for AsyncReferenceField functionality - All tests use pytest-asyncio for async test execution - Tests cover save, reload, delete, update, queries, and references
- Modify Document base class to support async variants - Modify QuerySet base class to support async variants - Extract shared logic to support both sync and async implementations - Maintain backward compatibility with existing sync API
- Replace MongoDB Atlas connection strings with localhost - Use localhost:27017 for all async transaction tests - Ensures tests work with local MongoDB instances
hiresh-verma
force-pushed
the
pymongo-async-implementation
branch
from
December 26, 2025 15:16
3033f97 to
106fcd9
Compare
…gers and document classes
…nting and dereferencing control
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.