Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populate with query #26

Open
NsSumse opened this issue Apr 15, 2018 · 2 comments
Open

Populate with query #26

NsSumse opened this issue Apr 15, 2018 · 2 comments

Comments

@NsSumse
Copy link

NsSumse commented Apr 15, 2018

Is there a plan to add (sort/query) support for populating?

@icebob
Copy link
Member

icebob commented Apr 16, 2018

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 } })));
            }
        }
    }
}

@NsSumse
Copy link
Author

NsSumse commented Apr 17, 2018

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
        }
    }
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants