$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:
Important - security issue in version before 1.9.0 When you enable $populate your service is not full secure, for now we did't handle security for populate as object, for example:
request with this query fill fetch users
Last updated
Was this helpful?