Ralf Vogler
02/24/2021, 12:50 PMinclude
only populates immediate children. Is there a recursive include or do I have to build the tree myself? What if I want to order/filter/limit the roots? I want to avoid having to do multiple queries.Ralf Vogler
02/24/2021, 12:55 PMmodel Todo {
id Int @id @default(autoincrement())
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
text String // mutable
done Boolean @default(false) // mutable
parentId Int? // mutable; TODO not used yet
parent Todo? @relation("tree", fields: [parentId], references: [id])
children Todo[] @relation("tree")
}
await db.todo.findMany({include: {children: true}})
Ryan
02/24/2021, 1:06 PM