How to ensure abort of operations in bulk write in case of network failure

i am working on collecting addresses and quantities of some cryptocurrency every time the transactions in a range of blocks is fetched through web3, i query the db to get the addresses in these transactions and save them .
process their quantities based on the transactions list i have, and if their quantity got to 0 i should delete ,if they are at the receiving end but not exist in db i insert them, else i update their new value then send it to the update method .
Look The Code Below
now the problem happened when i stopped the program while awaiting for bulkwrite then start it again and it threw an error that the address that sent crypto doesn’t exist in the db i am getting transactions from genesis so there is no way it was missed so the only way this happen is that it didn’t record in the db like it didn’t get inserted i assume from ACID that in case of network failure the db return to the state before the operation but this is bulk of operations and i want to reverse them all
my environment : i have mongodb server and mongodb compass to work locally first i am using mongodb 5.5.0

UpdateAddresses: async (contractAddress,arrayOfAddresses, lastBlock) => {
    let bulkOperations = => {
      if(entry.quantity === "0")
        return { 
          deleteOne: {
          filter: { address: entry.address } 
      return {
          update: { $set: { quantity: entry.quantity } },
      update:{ $set: { lastBlockChecked: lastBlock } }
    await db.collection(contractAddress).bulkWrite(bulkOperations)