FindManyOptions
FindManyOptions =
object
Defined in: packages/db/src/types.ts:177
Options for db.query(table).findMany().
The where condition is AND’d with any permission-based WHERE clauses
resolved from the user’s grants.
Example
Section titled “Example”import { eq, desc } from "drizzle-orm";
db.query(posts).findMany({ columns: { id: true, title: true }, where: eq(posts.category, "tech"), orderBy: desc(posts.createdAt), limit: 10, offset: 20, with: { comments: true }, cache: { ttl: "5m", tags: ["posts"] },});Properties
Section titled “Properties”cache?
Section titled “cache?”
optionalcache:QueryCacheOptions
Defined in: packages/db/src/types.ts:195
Per-query cache control. Pass false to skip caching, or an object to customize.
columns?
Section titled “columns?”
optionalcolumns:Record<string,boolean>
Defined in: packages/db/src/types.ts:179
Column selection (e.g., { id: true, title: true }). Omit to select all columns.
limit?
Section titled “limit?”
optionallimit:number
Defined in: packages/db/src/types.ts:185
Maximum number of rows to return.
offset?
Section titled “offset?”
optionaloffset:number
Defined in: packages/db/src/types.ts:187
Number of rows to skip (for offset-based pagination).
orderBy?
Section titled “orderBy?”
optionalorderBy:unknown
Defined in: packages/db/src/types.ts:183
Ordering expression (e.g., desc(posts.createdAt)).
where?
Section titled “where?”
optionalwhere:unknown
Defined in: packages/db/src/types.ts:181
User-supplied filter condition (AND’d with permission filters at .run() time).
optionalwith:Record<string,unknown>
Defined in: packages/db/src/types.ts:193
Drizzle relational query includes (e.g., { comments: true }).
Note: Permission filters are only applied to the root table, not to joined relations.