-
Notifications
You must be signed in to change notification settings - Fork 89
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
How to filter fastjoin datas #360
Comments
You do not mention if you want to use BatchLoaders or not. I'll assume not. Both records have a label field. I'll assume you want to join a Countries record to a Cities record using them. module.exports = {
joins: {
colours: (...args) => async (city, context) => {
city.country = await context.app.service('countries').find({
query: { label: city.label }, paginate: false
})
} } }; |
Thanks for your answer, but this is not really what I wanted, I think. Let me give you a more precise example : A countries document : A cities document : When I make a get rest query to "/cities", i want to get the label of the country, populated thanks to fastjoin. Which works great by joining with the ids, in an "after all" hook. I get something like that as a result : But my real problem now, is to be able to filter this result by selecting a specific country label (from Postman for example). Ex : GET /cities?countries[label="France"] Is it possible ? I've remarqued that populated fields are not known, to the query selector, I can only filter by "countries_id", which is not very sexy to use. I dont use batchloaders at the moment |
How would you code that using normal Feathers services, without fastJoin? |
I have no idea :/ |
Let me know when you do. Then we can map it to fastJoin. Perhaps you can
post the issue to feathersjs/feathers or ask on Slack.
…On Thu, Feb 15, 2018 at 1:10 PM, Amaury Muchembled ***@***.*** > wrote:
I have no idea :/
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#360 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABezn7bLr0k2ZVkVwvZIaMqiJKioPugoks5tVHMcgaJpZM4SF6EW>
.
|
I think you can get the results you want with GET /countries[label="France"]?cities |
Hello,
I've make two test services :
In order to get the country label, when calling the cities endpoint, i've used fastjoin which works very well.
But my question is : How do I filter my request by passing a label value instead of an object ID ?
Example :
FROM : GET /cities?countries_id=1234...
TO : GET /cities?countries.label="Paris" (or something like that)
Thanks for your help !
The text was updated successfully, but these errors were encountered: