feathers-populate-hook
Feathers hook to populate multiple fields with one to many, many to one and many to many relations. (For m:m cascade the populate hooks on a linking service.)
Installation:
npm install feathers-populate-hook
Example setup:
const populate = ; messageService; messageService
Query options
Set query defaults for the internal service call, i.e. $select, $order
Block some populates from the client:
set query.$populate
to {dontPopulateField: 0}
Block all populates:
set query.$populate
to false
or 0
You can also use $populate
as a param.
Remove populate.compatibility()
hook to disallow the query to modify the behaviour.
Disable populate by default
If you want the default behaviour to be false
add a custom hook:
function(hook) {
hook.params.$populate = !!hook.params.query.$populate;
delete hook.params.query.$populate;
return hook;
};