-
Type: Task
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Schema Validation, UI / UX
-
None
Given $jsonSchema in MongoDB is slightly different from the standard, we could help users to start by generating some basic schema for their collection when they click 'Add Rule'. For example, suggest type checks.
If you use some of the online tools to generate JSON Schema you'll get something like this:
{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "properties": { "student_name": { "type": "string" }, ... }, "required": [ ... ] }
This is not easily copy-pasteable into the editor. If the editor contained some valid default value, it would make it easier for users to understand how to compose the rule.
{$jsonSchema: { "properties": { "student_name": { "bsonType": "string" }, "class_id": { "bsonType": "int" } } }}
This is available in Realm during configuration of the collection: