moleculer-db
moleculer-db copied to clipboard
Populate with query
Is there a plan to add (sort/query) support for populating?
If you need more complex populating, use this form:
{
settings: {
populates: {
termCount(ids, books, rule, ctx) {
return this.Promise.all(books.map(async book => book.termCount = await ctx.call("terms.count", { query: { book: book._id } })));
}
}
}
}
I'd like to populate with the parameters in my call.
broker.call('v1.User.find', {
query: {},
populate: {
books: {
query: {
price: 50
},
populate: {
//sth else
},
page: 2,
pageSize: 10
}
}
});