
Switching from Document Validation to JSON Schema Validation The next section highlights the features and benefits of using JSON Schema Validation. Starting with MongoDB 3.6, JSON Schema is the recommended way of enforcing Schema Validation. These are the new features we will focus on in this blog post, as well as the ability to build business validation rules. JSON Schema Validation extends Document Validation in many different ways, including the ability to enforce schemas inside arrays and prevent unapproved attributes from being added. Announcing JSON Schema Validation supportīuilding upon MongoDB 3.2’s Document Validation functionality, MongoDB 3.6 introduces a more powerful way of enforcing schemas in the database, with its support of JSON Schema Validation, a specification which is part of IETF’s emerging JSON Schema standard. These are definitely not the final set of tools we will provide, but is rather an important step in how MongoDB handles schema. As MongoDB’s CTO, Eliot Horowitz, highlighted in Document Validation and What Dynamic Schemas means:Īlong with the rest of the 3.2 "schema when you need it" features, document validation gives MongoDB a new, powerful way to keep data clean.

MongoDB 3.2 was the first release to introduce Document Validation, one of the features that developers and DBAs who are accustomed to relational databases kept demanding.

These controls are especially important when multiple applications write into the same database, or when analytics processes rely on predefined data structures to be accurate and useful. However, as applications mature and scale, they tend to reach a stable stage where frequent schema changes are no longer critical or must be rolled out in a more controlled fashion, to prevent undesirable data from being inserted into the database.
JSON QUERY LANGUAGE UPDATE
One of MongoDB’s key strengths has always been developer empowerment: by relying on a flexible schema architecture, MongoDB makes it easier and faster for applications to move through the development stages from proof-of-concept to production and iterate over update cycles as requirements evolve.
