payload-hooks — Optimization
Declare the auth collection
Section titled “Declare the auth collection”Declare an auth collection in the config to include it in auditing. Payload creates its implicit users collection after plugins run.
Interpret write events in context
Section titled “Interpret write events in context”Write events from afterChange and afterDelete run before the database transaction commits.
Avoid read auditing by default
Section titled “Avoid read auditing by default”Read auditing is off by default. When enabled, find logs once per request with a count, while findByID logs the document ID.
Treat audit output as logs
Section titled “Treat audit output as logs”The plugin does not persist database audit records. Authentication auditing covers successful logins and password resets, not failed logins.