LeulAria
LeulAria
DTDrizzle Team
Created by LeulAria on 8/8/2024 in #help
DEEPLY NESTED QUERY using { with }
const categories = await db.query.category.findMany({
with: {
categories: true
}
})
const categories = await db.query.category.findMany({
with: {
categories: true
}
})
im querying by the above query my schema is below
export const category = pgTable("category", {
id: uuid("id").primaryKey().defaultRandom(),
slug: varchar("slug", { length: 255 }).notNull(),
name: varchar("name", { length: 255 }).notNull(),
parent_id: uuid("parent_id").references((): AnyPgColumn => category.id)
});
export const category = pgTable("category", {
id: uuid("id").primaryKey().defaultRandom(),
slug: varchar("slug", { length: 255 }).notNull(),
name: varchar("name", { length: 255 }).notNull(),
parent_id: uuid("parent_id").references((): AnyPgColumn => category.id)
});
it can return 1 deep but after that child is not populating help?
7 replies