Refty / mongo-thingy

:leaves: Powerful schema-less ODM for MongoDB and Python (sync + async)
https://mongo-thingy.readthedocs.io
MIT License
68 stars 12 forks source link

[Feature] Support Transactions #30

Open candlecare opened 4 years ago

candlecare commented 4 years ago

Do you have any plan to support Transactions in mongo-thingy?

https://api.mongodb.com/python/current/api/pymongo/client_session.html#transactions

Thanks.

Sithu

ramnes commented 4 years ago

No plan yet as we still didn't switch to MongoDB 4.x, but that would be a great feature indeed!

Supposedly we just have to add a session argument in a few methods and pass it to PyMongo, which is really not much. Pull requests welcome!

ramnes commented 1 year ago

API I have in mind at the moment:

with mongo_thingy.Transaction():
    Foo.delete_one()
    Bar().save()