I'd like to enforce a database schema in Firestore, a noSQL style database that does not require scheme by default.
So far, I've looked into using the Firebase Rules system as a possible avenue for schema enforcement: https://firebase.google.com/docs/firestore/security/rules-structure
I would like to:
- Ensure that certain fields have the proper data type (String, Number, bool)
- Ensure that certain fields exist (ex: firstName and lastName on a User class)
- Ensure that fields are set to 'undefined' if not needed. (This one I'm not sure about - do I need to do this?)
Has anyone found a good way to enforce schema from the server side?