© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Drizzle TeamDT
Drizzle Team•2y ago•
6 replies
LeulAria

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?
Drizzle TeamJoin
The official Discord for all Drizzle related projects, such as Drizzle ORM, Drizzle Kit, Drizzle Studio and more!
11,879Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Deeply nested "with" param in query is failing
Drizzle TeamDTDrizzle Team / help
2y ago
GraphQL deeply nested relations
Drizzle TeamDTDrizzle Team / help
11mo ago
Help with nested query
Drizzle TeamDTDrizzle Team / help
2y ago
nested query
Drizzle TeamDTDrizzle Team / help
3y ago