Collection selection

This is the official documentation of the @forestadmin/agent Node.js agent.

You may not want to import all collections from a data source.

This can be achieved by providing a whitelist or a blacklist in the options of the agent.addDataSource method.

const { createAgent } = require('@forestadmin/agent');
const { createSqlDataSource } = require('@forestadmin/datasource-sql');

const agent = createAgent(options);
const aDataSource = createSqlDataSource(
  'postgres://user:pass@localhost:5432/mySchema',
);
const anotherDataSource = createSqlDataSource(
  'postgres://user:pass@localhost:5432/myOtherSchema',
);

// Specify which collections you want to play with
agent
  .addDataSource(aDataSource, { include: ['books', 'reviews'] })
  .addDataSource(anotherDataSource, { exclude: ['authors'] });

Last updated