-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MongoDB Atlas Conditional Schema #1743
Comments
➤ PM Bot commented: Jira ticket: RDART-1068 |
No, conditional schema is not supported on the server. |
Thanks for coming back @nirinchev. Is this the case even if we make the properties that change 'required / not-required' as 'always not-required' in the Realm schema? If not possible, is this a Realm Flutter limitation or a Realm Core limitation please? |
It's a combination of limitations - (and to clarify the AppServices json schema support is different from the MongoDB server json schema support) |
Completely get the complexities of 'conditional schema' and why Device Sync / Realm Flutter does not support it. If we ignore 'conditional schema' for a moment, will the below work: So if we had the below property schema, Device Sync / Realm schema will not care about the Atlas schema validation, so from Device Sync / Realm schema point of view as the properties are always 'not required' (in Device Sync / Realm) it does not matter if they are 'required' or 'not required' in Atlas?
So the above is not using conditional schema in Device Sync / Realm, just facilitating it via never expecting the property to be required. (for context, we are not mutating data via Realm / Device Sync - we mutate data via Atlas only and then only use Realm / Device Sync to sync data to local devices from Atlas) |
I see - yes, that should work. If a write comes in from Realm/Device Sync that seems to pass the Device Sync schema validation, but fails the Atlas schema validation, a compensating write will be synthesized that reverts it on the client. E.g. if you have a rule where |
Perfect, thats amazing! Thanks @nirinchev |
What happened?
May we ask if MongoDB Atlas Conditional Schema https://www.mongodb.com/community/forums/t/validate-schema-with-conditions/121759/2 is supported? We want to basically have a model with 2 x sets of DB schema which 'are identical' except for the 'required fields' in MongoDB Atlas (i.e. the same field may be required and not required in the MongoDB Atlas schema). In this instance we assume Realm Device sync will support this as long as we make the field in Realm as 'not required'.
example MongoDB Atlas schema validation:
Example desired Flutter Realm Schema:
Repro steps
na
Version
na
What Atlas Services are you using?
Both Atlas Device Sync and Atlas App Services
What type of application is this?
Flutter Application
Client OS and version
na
Code snippets
na
Stacktrace of the exception/crash you're getting
Relevant log output
The text was updated successfully, but these errors were encountered: