Home > Mobile >  MongoDB drop collection and insert new data transactionally
MongoDB drop collection and insert new data transactionally

Time:10-15

I'm thinking of trying mongoDb for a project I'm working on but don't have too much experience with it.

I'm wondering if it's possible to, in a transaction, drop the current collection, insert all the new data in a collection with the same name, then commit the transaction. While the old data is still available during the fill up with new data and then right after the transaction is commited the new data will be used.

Also might this create performance issues?

CodePudding user response:

Dropping a collection is not allowed in a transaction: https://docs.mongodb.com/manual/core/transactions/#restricted-operations

  • Related