$Populate

1- You need to allow $populate at service level

  module.exports = function (app) {
    const Model = createModel(app);
    const paginate = app.get('paginate');
    const options = {
      Model,
      paginate,
      whitelist: '$populate',
    }
  }

2- You need to allow $populate at rule level

  const options = {
    Model,
    paginate,
    whitelist: '$populate',
    serviceRules: [
      {
        'actions': ['manage'],
        'roles': ['admin'],
        'populateWhitelist': ['categories'] // Alow admin to populate categories
      },
    ],
  };

3 - deep populate

from "versions": "1.9.0"

you can controlled deep populate from rule.populateWhitelist

rule example:

'$populate' examples:

request example:

simple Request example

http://localhost:3030/products?$limit=5&$populate=categories,colors

4- Optional - Dashboard configuration-

To populate filed inside dashboard screen add this:

Need to populate collection of private files ? check this guide:

Last updated

Was this helpful?