From 9ab0346daea06d1c19d2b8eaee11f52df1c6a50b Mon Sep 17 00:00:00 2001 From: Morgan Peyre Date: Wed, 22 Apr 2026 07:29:41 +0200 Subject: [PATCH] docs: add subsection for advanced database configuration options (#9149) Co-authored-by: Morgan PEYRE --- docs/content/docs/reference/options.mdx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/content/docs/reference/options.mdx b/docs/content/docs/reference/options.mdx index 9305052fbb..5182b22b1b 100644 --- a/docs/content/docs/reference/options.mdx +++ b/docs/content/docs/reference/options.mdx @@ -649,6 +649,26 @@ export const auth = betterAuth({ * `skipTrailingSlashes`: Skip trailing slash validation in route matching. (default: `false`) * OAuth state configuration options (`storeStateStrategy`, `skipStateCookieCheck`) are now part of the `account` option +

database

+ +Set custom strategies for ID generation and findMany queries. + +* `generateId`: Controls how record IDs are generated. Accepts a custom function, `false`, `"serial"`, or `"uuid"` (default: [random base62 string](https://github.com/better-auth/better-auth/blob/main/packages/core/src/utils/id.ts)). See the [Database documentation](/docs/concepts/database#id-generation) for more info. +* `defaultFindManyLimit`: The default maximum number of records returned by the `findMany` adapter method. (default: `100`) + +```ts +import { betterAuth } from "better-auth"; + +export const auth = betterAuth({ + advanced: { + database: { + generateId: "uuid", + defaultFindManyLimit: 50, + }, + }, +}); +``` + ### `backgroundTasks` Configure background task handling for deferred operations. Background tasks allow non-critical operations (like cleanup, analytics, timing-attack mitigation, or rate limit counter updates) to run after the response is sent. This can significantly improve response times on serverless platforms.