'Prisma nested recursive relations depth

I must query a group and all of its subgroups from the same model.

However, when fetching from Group table as shown below, Prisma doesn't include more than a 1-depth to the resulting Subgroups relation (subgroups of subgroups being left out). Subgroups attribute holds an array whose elements are of same type as the said model (recursive).

model Group {
  id                Int         @id @default(autoincrement())
  parentId          Int?
  Parent            Group?      @relation("parentId", fields: [parentId], references: [id])
  Subgroups         Group[]     @relation("parentId")
}
GroupModel.findFirst({
  where:   { id: _id },
  include: { Subgroups: true }
});

I guess this might be some sort of safeguard to avoid infinite recursive models when generating results. Is there any way of dodging this limitation (if it's one), and if so, how?

Thanks



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source