Reputation: 5533
I have REST apis that creates mongoDB collection at runtime and keeps the collection name in another collection.
MongoDB now supports transaction and does allow only CRUD operations within a transaction not create collection operation.
Im thinking that to keep all the collection names within a transaction in request context and create the collections once transaction is completed. Is there any other way or workaround to solve this ?
Upvotes: 1
Views: 387
Reputation: 222
Starting from Mongo 4.4, you can create collections and indexes inside transactions. Documentation
Upvotes: 1