-
Type: Improvement
-
Resolution: Duplicate
-
Priority: 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:
- at the document level
- everything is optional, meaning no need to validate anything by default
- some fields can be marked as "required" or "optional".
- fields can have a list of acceptable data types
- fields can have value ranges
- at the collection level
- required indexes
- allow for table scans or not
- 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.
- duplicates
-
SERVER-3536 templates for schemas
- Closed