system-designer icon indicating copy to clipboard operation
system-designer copied to clipboard

Can I list all existing models in js behavior

Open ibrahimmina opened this issue 5 years ago β€’ 1 comments

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

ibrahimmina avatar Mar 12 '21 14:03 ibrahimmina

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.

ecarriou avatar Mar 12 '21 19:03 ecarriou