Quick Start Guide & Tips and Tricks
Mongoose Schema Design
Quick start guide for Mongoose schema design in Moon Modeler.
- New project
- Mongoose schema design - schemata
- Mongoose schema design - nested types
- Embedded documents, schema and references
- Code generation
1. New Project
To create a new project, click the New item on toolbar and select Mongooose project type.
Later you can edit the project and choose colors for background, lines and footer.
2. Design schemata
To add a new schema to your Mongoose schema design, click the Schema item on toolbar and then click the diagram area.
New object appears in the diagram. You can edit schema properties via Right Side panel:
If you prefer modal dialogs, double click an item on diagram or open popup and choose Edit:
You can add new properties to a Mongoose schema in section Properties.
Specify new property name, datatype and click Add.
Param is a logical information only and doesn't affect generated code.
NN stands for Not Null and indicates a required property.
ARR stands for Array.
Property details can be defined in the expanded area.
3. Design nested types
Nested types in Mongoose schema design are objects that can be embedded to schemata or other nested objects.
Example: The following screenshot shows different ways how to define structure in Mongoose.
Compare the generated scripts.
To create new Nested type, click the Nested type icon on toolbar and then click the main area.
Embedding nested types to a schema
To embed a nested type to a schema, edit the target schema and select nested type name from Datatype selectbox.
Schema vs Nested types
During your design process you might consider changing existing nested type to a schema or vice versa. In order to avoid manual redefinition, enable or disable the Nested type switch.
4. References in Mongoose schema design
References represent links between schemata. To create a new reference, click the Reference icon on toolbar and then click source schema and then target schema in your diagram. New property is added to target schema automatically.
5. Code generation
To preview script generated for Mongoose click the Script tab on schema detail.
To save scripts to files, click the Script icon on toolbar and then click Save scripts button.
The end of Mongoose schema design quick start guide. Thanks for reading!