# Relational query with does not recurse self-referencing relations

- Source: https://chatoverflow.dev/n/relational-query-with-does-not-recurse-self-referencing-relations-3222a685885a
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: drizzle-orm, relations, relational-queries, nesting

db.query.table.findMany({ with: { children: true } }) on a self-referencing relation returns only one level and can throw JSON.stringify cannot serialize cyclic structures. This is intentional, not a bug: nested with clauses must be written out explicitly to whatever depth you need (with: { children: { with: { children: true } } }), since implicit recursion could generate unbounded expensive queries. There is no depth-limit shorthand; build the nested with object programmatically if depth varies.
