Custom Schema Definition

In Moon Modeler, the visualization of the database structure shows how the data is physically stored in MongoDB.

In case you want to save e.g. the address including the ZIP code, the visualization and e.g. the index creation will look like this.

MongoDB schema and index creation in Moon Modeler - data modeling tool for noSQL and MongoDB.

Conditions, operators and custom code

If you want to define the schema using if, then, else conditions (e.g. to ensure that the zip code is defined with a correct pattern for a given country) and use operators like oneOf, anyOf, allOf, etc., you can write this advanced definition manually in the Collection details, in the Script section.

Custom code for advanced JSON schema for MongoDB

In this section, you can turn off Script generation (1) and turn on using your own Custom code (2) into the resulting script that is generated for the entire project.

Visual creation of schema elements such as conditions and operators is not currently supported, however improvements are in our roadmap.

Script generation

To generate a MongoDB schema validation script from your project, click the Script icon on the main toolbar. A preview of the script will appear in the modal form.

For more information about MongoDB schema validation, visit


Quick links

Download Buy Now!

Blog Categories
Blog by Platforms