Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Can I list all existing models in js behavior #138

Open
ibrahimmina opened this issue Mar 12, 2021 · 1 comment
Open

Can I list all existing models in js behavior #138

ibrahimmina opened this issue Mar 12, 2021 · 1 comment
Labels

Comments

@ibrahimmina
Copy link

ibrahimmina commented Mar 12, 2021

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
Copy link
Member

ecarriou commented Mar 12, 2021

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants