Filtering based on nested relation from one direction (many to many) #17700
Replies: 2 comments 1 reply
-
|
Hello @SheaBelsky 👋 For your use case, if
then wouldn't the Also, I believe going through the option model would be much easier. |
Beta Was this translation helpful? Give feedback.
-
|
Hi there, To keep our discussions organized and focused on the most relevant topics, we’re reviewing and tidying up our backlog. As part of this process, we’re closing discussions that haven’t had any recent activity and appear to be outdated. If this discussion is still important to you or unresolved, we’d love to hear from you! Feel free to reopen it or start a new one with updated details. For more details about our priorities and vision for the future of Prisma ORM, check out our latest blog post: https://www.prisma.io/blog/prisma-orm-manifesto. Thank you for your understanding and being part of the community! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Consider these two models:
I want to be able to write a
prisma.user.findManyquery that returns all users whoseoptionsentry exist in an array of IDs. For example,["testId1", "testId2", "testId3"]. From my understanding, the existing relation filters (every/some/none) don't work as-is for this purpose because they iterate over everyUserto see if they pass a given condition.Consider;
What this means is if a given User has
optionsequal to["testId1", "testId2", "testId3", "testId4"], I would not be able to useeverybecausetestId4fails the "every" condition (everyoptionsID for this user does not exist in the provided array.)somedoesn't work in this scenario because a User will be returned even if a given User does not have every one of the provided Options - in this scenario, a User must have all of them, but it's perfectly acceptable if they have other Options too. Is this possible only withprisma.user.findMany, or do I have to useprisma.option.findManyfor this purpose?Beta Was this translation helpful? Give feedback.
All reactions