Add find_one_and_update
method to Document class for atomic operations with object return
#1229
Hambaobao
started this conversation in
Feature Request
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Currently, Beanie doesn't provide a convenient way to perform atomic
find_one_and_update
operations while returning a Beanie Document object. Users have to choose between:get_pymongo_collection().find_one_and_update()
- atomic but returns raw dictfind_one()
+save()
- returns object but not atomicThis forces developers to either sacrifice atomicity or deal with manual dict-to-object conversion.
Current Workaround
Proposed Solution
Add
find_one_and_update
method to the Document class that:Suggested API
Use Cases
Benefits
This would greatly improve the developer experience when working with atomic operations in Beanie applications.
Beta Was this translation helpful? Give feedback.
All reactions