Filtering via a relational field with multiple collections doesn't work #2837
Replies: 1 comment 1 reply
-
Hey @rymate1234, thanks for the input and reaching out to us with your findings! I went ahead and reviewed the issue you highlighted and this actually looks to be more of an enhancement rather than a bug. There is some complexity and potential impact on performance with this kind of feature. I am going to convert this into a discussion for a thorough evaluation. I'll tag it as a potential new feature, and encourage you to share any further insights in the discussion. However, as a workaround for now, you could query your relationships directly instead of through the relationship field and then those IDs to return your documents. Does that make sense? Thanks again and let me know! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Link to reproduction
https://github.com/rymate1234/payload/tree/reprod/multi-relational-filter
To Reproduce
[23:09:23] ERROR (payload): QueryError: The following path cannot be queried: associatedMedia
at Function.buildQuery (/Users/murthick/Projects/Mythical/payload/src/mongoose/buildQuery.ts:591:15)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at async find (/Users/murthick/Projects/Mythical/payload/src/collections/operations/find.ts:103:17)
at async findHandler (/Users/murthick/Projects/Mythical/payload/src/collections/requestHandlers/find.ts:23:20)
Describe the Bug
Filtering by multiple relations doesn't work, presumably because the filter should be
associatedMedia__value
Payload Version
1.7.5, but reproduced in latest master
Beta Was this translation helpful? Give feedback.
All reactions