Firebase Cloud Functions has a onWrite trigger, but does it have something like a beforeWrite trigger? If not, what is the simplest way to achieve this?
This is not possible with Cloud Functions. They only trigger after some action occurs. The events received describe the action. This is true for all types of event providers, not just Firestore.
The only way to reliably prevent something from happening is to use a security rule that rejects a read or write.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With