P
Prisma3mo ago
lobieses

nested incuding

by some specific reason i should to take data in table by pattern now i have this query const resources = await this.prismaService.resource.findMany({ where: { id: 'some', }, include: { children: { include: { children: { include: { children: true, }, }, }, }, }, }); can i somehow avoid this nested selecting and set including for all childrens their childrens? Or maybe i can use some other ways?
2 Replies
Nurul
Nurul3mo ago
Hey 👋 If I understand correctly, you want to load all child relations dynamically, depending on whether a child relation exists or not, right? You don't want a fixed number of deep nesting. In case, what I understand is correct then there is no way to automatically include all nested relations yet. You would need to specify the relations manually for all levels.
lobieses
lobieses2mo ago
got it, thank