[SERVER-14481] Validating schema on the server side Created: 07/Jul/14  Updated: 10/Nov/14  Resolved: 10/Nov/14

Status: Closed
Project: Core Server
Component/s: Diagnostics, Usability
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Daniel Coupal Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-3536 templates for schemas Closed
Participants:

 Description   

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.



 Comments   
Comment by Daniel Coupal [ 07/Nov/14 ]

You can close as duplicate of SERVER-3536.

Generated at Thu Feb 08 03:35:00 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.