system-designer
system-designer copied to clipboard
Can I list all existing models in js behavior
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
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.