I have configured a basic schema validation in Realm Sync: minLength and maxLength of a string property.
To my surprise, a node.js client ignores the validation and inserts a new document just fine. Running the validation check gives StringLengthLTEError and StringLengthGTEError as expected. This can’t be the expected behaviour? I would assume an error similar to when a required property is missing, catchable by error handler.
Moving on, I tried to put a validation rule in Atlas with action Error. Now, in the Realm log, I get a TranslatorCorrectiveErasureError with message “Failed to apply realm changes to MongoDB. This has been resolved by removing the object from the synced realm.”. My new document is created, synced and deleted! My client gets notified about the index being deleted but I’m expecting an error.
I’m grateful for any insight of how to do proper schema validations in Realm Sync.