Post hook in transaction

Im using mongoose post hooks.
I have logic that needs to happen on particular changes in document.
I can detect those changes in post hook. Everything worked fine.

How can i make post hook be part of transaction. If it fails, document it self also isn’t committed to db.
I read on internet that i should put such code in post hooks, but rather right beside needed place.

But i have 30+ places where this document is updated. For now in 20+ of those places particular condition can occur that this callback is needed. It seems odd, to put it in all those places :expressionless:

Business guarantee should be that this logic either happens or document isn’t saved.