Revert bulk write actions when single action fails

For bulk writes, you can etiher choose to execute following actions after one actions fails or throw an error. Isn’t there a way to reverse previous writes after the failed write happens?
I feel like this is a really obvious feature that I missed.


There are Ordered and Unordered Bulk Write operations. With ordered writes, after a failure (or error) with one of the writes the following writes are not executed. There is no way you can reverse the earlier writes which were written before the failure. But, if you are using Transactions, you can control to abort (or rollbcak) the previous writes (please note MongoDB Transactions require your cluster to be a Replica Set or a Sharded Cluster).

Thanks, Exactly what I was looking for! I think mongodb should link transactions in the bulk write docs because they are closely related