Include/exclude models

Please be sure of your agent type and version and pick the right documentation accordingly.

This is the documentation of the forest-express-sequelize and forest-express-mongoose Node.js agents that will soon reach end-of-support.

forest-express-sequelize v9 and forest-express-mongoose v9 are replaced by @forestadmin/agent v1.

Please check your agent type and version and read on or switch to the right documentation.

Include/exclude models

By default, all models declared in your app are analyzed by the Forest Admin agent in order to display them as collections in your admin panel.

You can exclude some of them from the analysis to never send their metadata to Forest Admin. By doing this, these models will therefore never be available in your admin panel.

To do so, add the following code to either define which models are included or excluded.

Include models

middlewares/forestadmin.js
...

app.use(require('forest-express-sequelize').init({
  envSecret: process.env.FOREST_ENV_SECRET,
  authSecret: process.env.FOREST_AUTH_SECRET,
  objectMapping,
  connections,
  includedModels: ['customers']
}));

...

Exclude models

middlewares/forestadmin.js
...

app.use(require('forest-express-sequelize').init({
  envSecret: process.env.FOREST_ENV_SECRET,
  authSecret: process.env.FOREST_AUTH_SECRET,
  objectMapping,
  connections,
  excludedModels: ['documents', 'transactions']
}));

...

Last updated