-
Given I have already retrieved my await PrismaClient().parentModel.findOne(/* some query */) And my model has one-to-many relationships to a I couldn't find in the docs a good solution for this. I know that I can do: await PrismaClient().parentModel.findOne(/* some query */).childModels() but because I know I could do: await PrismaClient().childModel.findMany({where: { parentModelId: parentModel.id }}) But that feels like a lot of boiler plate. Is there a better way? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
Bump to see if anyone has any ideas or if maybe this should be a feature request (lazy fetching in the model rather than the client). |
Beta Was this translation helpful? Give feedback.
-
That would not be too bad to use the fluent API if it was optimized. I would really prefer if Prisma sticks with plain javascript objects IMO. No magic, no problem. |
Beta Was this translation helpful? Give feedback.
Hey @nrxus 👋
Currently Prisma 2 only supports eager fetching via the ways that you have mentioned above and also with the
include
option while querying.Could you open a Feature Request here stating the above use case?