Skip to content

Conversation

@imsidkg
Copy link

@imsidkg imsidkg commented Nov 26, 2025

What?

Fixes the beforeOperation collection hook being called when using the findVersions operation, just as it is for the standard find operation.

Why?

Previously, the beforeOperation hook was only triggered for standard find operations, but not for findVersions. This led to inconsistent behavior, as custom logic (such as access control, logging, or argument modification) defined in beforeOperation would not run when querying document versions. This PR brings parity and predictability to hook execution across both operations.

How?

The logic for invoking the beforeOperation hook (as seen in find.ts) was added to findVersions.ts.
Now, when findVersions is called, all registered beforeOperation hooks are executed with the correct arguments before the main operation logic runs.

Fixes
#14726

@imsidkg imsidkg changed the title fix(core): add beforeOperation hook in findVersions collections operations fix: add beforeOperation hook in findVersions collections operations Nov 26, 2025
@jhb-dev
Copy link
Contributor

jhb-dev commented Nov 28, 2025

Hi @imsidkg, thanks for creating this PR to the issue I opened!

During a discussion with r1tsuu in the Discord, he noticed that the afterOperation hook is also not called for find operations. Could you maybe extend this PR to also call that?

@imsidkg
Copy link
Author

imsidkg commented Nov 28, 2025

sure @jhb-dev i will work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants