DEEPLY NESTED QUERY using { with }

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)
});


it can return 1 deep but after that child is not populating help?
Was this page helpful?