From e7d1d3053aa0c01685227dc6537e6485f7fbe7fa Mon Sep 17 00:00:00 2001 From: David Wensley Date: Mon, 1 Dec 2025 12:38:24 +0000 Subject: [PATCH 1/2] docs: clarify available operations for beforeOperation hook in collections documentation and made consistent with afterOperation hook. --- docs/hooks/collections.mdx | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/docs/hooks/collections.mdx b/docs/hooks/collections.mdx index 0deec8a7c0d..c0870529a50 100644 --- a/docs/hooks/collections.mdx +++ b/docs/hooks/collections.mdx @@ -67,6 +67,8 @@ export const CollectionWithHooks: CollectionConfig = { The `beforeOperation` hook can be used to modify the arguments that operations accept or execute side-effects that run before an operation begins. +Available Collection operations include `create`, `find`, `findByID`, `update`, `updateByID`, `delete`, `deleteByID`, `login`, `refresh`, and `forgotPassword`. + ```ts import type { CollectionBeforeOperationHook } from 'payload' @@ -81,12 +83,12 @@ const beforeOperationHook: CollectionBeforeOperationHook = async ({ The following arguments are provided to the `beforeOperation` hook: -| Option | Description | -| ---------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **`collection`** | The [Collection](../configuration/collections) in which this Hook is running against. Available options include: `autosave`, `count`, `countVersions`, `create`, `delete`, `forgotPassword`, `login`, `read`, `readDistinct`, `refresh`, `resetPassword`, `restoreVersion`, and `update`. | -| **`context`** | Custom context passed between Hooks. [More details](./context). | -| **`operation`** | The name of the operation that this hook is running within. | -| **`req`** | The [Web Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object. This is mocked for [Local API](../local-api/overview) operations. | +| Option | Description | +| ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------| +| **`collection`** | The [Collection](../configuration/collections) in which this Hook is running against. | +| **`context`** | Custom context passed between Hooks. [More details](./context). | +| **`operation`** | The name of the operation that this hook is running within. | +| **`req`** | The [Web Request](https://developer.mozilla.org/en-US/docs/Web/API/Request) object. This is mocked for [Local API](../local-api/overview) operations. | ### beforeValidate From 46d02f51b198dbcd57a08566907d7f2ccf29a8c7 Mon Sep 17 00:00:00 2001 From: David Wensley Date: Mon, 1 Dec 2025 17:44:00 +0000 Subject: [PATCH 2/2] docs: remove redundant operation listings from beforeOperation and afterOperation hook sections --- docs/hooks/collections.mdx | 4 ---- 1 file changed, 4 deletions(-) diff --git a/docs/hooks/collections.mdx b/docs/hooks/collections.mdx index c0870529a50..985ddc78ade 100644 --- a/docs/hooks/collections.mdx +++ b/docs/hooks/collections.mdx @@ -67,8 +67,6 @@ export const CollectionWithHooks: CollectionConfig = { The `beforeOperation` hook can be used to modify the arguments that operations accept or execute side-effects that run before an operation begins. -Available Collection operations include `create`, `find`, `findByID`, `update`, `updateByID`, `delete`, `deleteByID`, `login`, `refresh`, and `forgotPassword`. - ```ts import type { CollectionBeforeOperationHook } from 'payload' @@ -260,8 +258,6 @@ The following arguments are provided to the `afterDelete` hook: The `afterOperation` hook can be used to modify the result of operations or execute side-effects that run after an operation has completed. -Available Collection operations include `create`, `find`, `findByID`, `update`, `updateByID`, `delete`, `deleteByID`, `login`, `refresh`, and `forgotPassword`. - ```ts import type { CollectionAfterOperationHook } from 'payload'