-
-
Notifications
You must be signed in to change notification settings - Fork 36
Description
In recent releases, we made it possible to inject the Postgres client (both pooled and non-pooled) as a preparation for supporting transaction handling. So, it's possible to handle the transactions independently, but Pongo hasn't handled MongoDB transactions API yet. We need to do it, as this is one of the biggest selling points for using relational db instead of Mongo. Plus it can make easier handling in Emmett.
We already have an executeInTransaction
wrapper, but I think that it'd be necessary to include a transaction wrapper in a similar way as drizzle does it. That should make it easier to introduce other storage or switch Postgres client library (we might need to also support Postgres Js).
For Mongo Shim, we may try to do the mapping of the write concerns into the transaction isolation level.
References for MongoDB API:
- https://www.mongodb.com/docs/drivers/node/current/fundamentals/transactions/
- https://www.mongodb.com/developer/languages/javascript/node-transactions-3-3-2/
- https://www.digitalocean.com/community/tutorials/how-to-use-transactions-in-mongodb
- https://blog.allegro.tech/2022/12/transactions-in-mongodb.html