Uploaded image for project: 'Compass '
  1. Compass
  2. COMPASS-4803

Pre-populate validation rule editor with an example

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Unresolved
    • Icon: Major - P3 Major - P3
    • None
    • None
    • Schema Validation, UI / UX
    • None

    Description

      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:

      Attachments

        Activity

          People

            Unassigned Unassigned
            kateryna.kamenieva@mongodb.com Katya Kamenieva
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: