design-first / system-designer

A low-code development platform for creating systems 🇺🇦#standwithUkraine
https://designfirst.io/systemdesigner/
Apache License 2.0
930 stars 136 forks source link

Can I list all existing models in js behavior #138

Open ibrahimmina opened 3 years ago

ibrahimmina commented 3 years ago

I am looking to build a function to list all thr created models at the start of the system

The reason for this is that I have an html navbar and I want to build links in the nav bar to link to each model

ecarriou commented 3 years ago

Hello,

Yes you can list all existing models by requiring db component which is a lite NoSQL db that contains all your data (see this documentation for more informations).

Example:

this.require('db').collections()

will return an object with all the collections of the Database, and each collection name is a class/model name. Your models are the ones that are not 'private', i.e. that do not start with a _ in the name.