As you develop the model for your MongoDB collection or views, with field-level constraints and indexes, Hackolade dynamically generates corresponding scripts:

The information can be viewed in the MongoDB Script tab:

You may toggle between Create and Update views:

For version of MongoDB up to v3.4, the MongoDB script is in aggregation pipeline syntax.  From v3.6 up, the script is in $jsonschema syntax.

You may export these scripts to a JavaScript file with the menu option Tools > Forward-Engineering > MongoDB Script: