Filtering parent based on relative children collection information #2042
Unanswered
svantreeck
asked this question in
Q&A
Replies: 1 comment 3 replies
-
This is exactly how you can do it, it does not work for you? What query does it produce? What query do you expect? Let's not talk in pseudocode, as it just adds confusion, so try to create actual code snippet of what you have and provide the query you are trying to produce. |
Beta Was this translation helpful? Give feedback.
3 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Is your feature request related to a problem? Please describe.
I'd like to be able to filter a set of parent items based on some relative (based on sequences or date) data inside the child collection.
Describe the solution you'd like
With the data structure below, I'd like to make a query that would give me the
Parent
objects where theChild
record with the earliestcreatedDate
had a specificsomethingIWantToFilterOn
value.Describe alternatives you've considered
I think I could use knex's query builder to basically do an inner join with a subselect to calculate the value, but it would be nice to be able to use some of the smart query conditions to build the query instead of jumping to knex.
I was also thinking if I could use a filter somehow that way I could write this as shorthand in a couple locations if it needed reuse.
Additional context
Add any other context about the feature request here.
Another option I was thinking of was creating something like
firstChild
|lastChild
objects on the Parent...that might be more like the filter idea though.Beta Was this translation helpful? Give feedback.
All reactions