Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-14481

Validating schema on the server side

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Diagnostics, Usability
    • None

      We should have a way to describe a database schema and enforce the validation, preferably on the server side.
      Here are some examples of requirements, but it would probably be better to have a full specification document:

      1. at the document level
        1. everything is optional, meaning no need to validate anything by default
        2. some fields can be marked as "required" or "optional".
        3. fields can have a list of acceptable data types
        4. fields can have value ranges
      2. at the collection level
        1. required indexes
        2. allow for table scans or not
        3. attributes: capped?

      jsonschema is a good start, but would need to be expended to support the additional BSON types. However jsonschema is a little verbose.

      The schema representation, stored in the DB, should also allow for additional information (not used by the server) to be kept with the model. Such data could be:

      • estimates on number of docs
      • expected queries

      That data could be used by our partners to build tools to model the DB, create load tests, etc.

      Another interesting feature would be the ability to version the schema. That way, you can diff 2 versions to find the changes. Those changes could be expressed as a transformation/migration which could be applied automatically on old documents by external tools.

            Assignee:
            Unassigned Unassigned
            Reporter:
            daniel.coupal@mongodb.com Daniel Coupal
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: