beforeOperation hook not called for findVersions operation
Describe the Bug
The beforeOperation collection hook is not being called when using the findVersions operation, while it correctly triggers for normal find operations. This is inconsistent behavior - all operations should trigger beforeOperation hooks.
Expected Behavior
Both operations should trigger the beforeOperation hook:
-
payload.find()→beforeOperationhook called ✓ -
payload.findVersions()→beforeOperationhook called ✓
Actual Behavior
Only find triggers the hook:
-
payload.find()→beforeOperationhook called ✓ -
payload.findVersions()→beforeOperationhook NOT called ✗
Link to the code that reproduces this issue
https://github.com/jhb-dev/payload-find-versions-before-operation-hook-issue
Reproduction Steps
- Clone the reproduction repository
- Start the Payload dev server with
pnpm devand open it in your browser. - Check the server console for the reproduction.
Which area(s) are affected? (Select all that apply)
area: core
Environment Info
Binaries:
Node: 24.3.0
npm: 11.4.2
pnpm: 10.12.4
Relevant Packages:
payload: 3.64.0
next: 15.4.7
@payloadcms/db-mongodb: 3.64.0
@payloadcms/richtext-lexical: 3.64.0
react: 19.1.0
react-dom: 19.1.0
Operating System:
Platform: darwin
Arch: arm64
During a discussion with r1tsuu in the Discord, he noticed that the afterOperation hook is also not called for find operations.
🚀 This is included in version v3.67.0
This issue has been automatically locked. Please open a new issue if this issue persists with any additional detail.