While working with mongoose, I have the following two async operations
const user = await userModel.findOneAndDelete(filter, options);
await anotherAsyncFunctionToDeleteSomething(user); // not a database operation
But I need to ensure that both deletions happen or reject together. I've thought about putting trycatch on second function and recreate the user document if any error is caught (in the catch block). However, this doesn't seem like an efficient (or at least appealing) solution.