MongoDB JSON Generation
Go Up to Generating a Script File or Database
The DDL Generation Wizard lets you generate JSON code to build a MongoDB database.
To generate a script file or database:
- On the Data Model Explorer, select a physical model and then choose Database > Generate Database.
- Follow the pages of DDL Generation Wizard because they easily guide you through the rest of the process.
Generate Script File
- Generate a Single, Ordered Script File: If selected, it writes a single JSON file with specification of all objects.
- Database Creation Script File: This control allows you to provide the filename and path for the generated JSON file.
- Generate Objects To Multiple Files: If selected, it writes a separate JSON file for each selected object. Objects are ordered in subdirectories for each selected object class.
- Base Directory: This control allows you to specify the directory that is to contain the generated script files.
Generate Objects with a Database Connection
This option is not available during JSON file creation.
Wizard Quick Launch
See how you can load DDL Generation Wizard settings from a file created on a previous session.
Object Selection and Generation Options
The Generation Options are on the tabs where you select the objects in the data model for which you would like to build the JSON file. These options are easy to understand. Below you can see the explanation of some specific objects.
Under the Collection tab you can select which collections from your model that you would like to be added to your JSON file.
Under the Generation Options you can select how you want your JSON output to appear.
- Quote field names selects whether you want to add quotation marks around field names.
- Only quote field names containing..." means that only field names containing a period are enclosed in quotation marks.
- Quote all field names means that all field names in the generated JSON will be contained in quotation marks.
- Output as plain JSON means to remove all MongoDB-specific constructs when generating a database for a MongoDB model. This option removes MongoDb constructs such as ObjectId() and instead a generic JSON is generated.
- If you right-click anywhere on the object tree within the wizard, you can select or deselect all objects using the short-cut menu. You can also display or hide object owner names for those objects with owners.
- To view the DDL generated by the currently selected settings, click the JSON Preview button on the wizard at anytime. You can print or save the script directly from the JSON Preview dialog.
JSON Preview File
In this page you can check if you have selected all the objects you want to generate on the DDL and the options to do it.