Reputation: 18895
In some situations I need to completely overwrite a specific MongoDB collection by doing:
db.collection.remove()
db.collection.insert(doc)
multiple times. What if 1. succeeds but somewhere 2. fails? Is there a way to do a rollback when this fails? Any other way to go about this?
Upvotes: 4
Views: 1691
Reputation: 311855
If your collection isn't sharded you could:
Upvotes: 5