A hook that is triggered before a count()
operation.
The beforeCount()
hook runs when:
count()
function is called.Return a query or a Promise that resolves to a query from the beforeCount()
function. The returned query will be used as the query for the
count()
operation.
Often, you will modify the query that is received in the query
parameter
by calling one or more WixDataQuery
functions.
If the returned value is of the wrong type, the value is ignored.
A rejected Promise blocks the call to count()
and also calls the onFailure()
hook if it has been registered.
Because the beforeCount()
hook is called before count()
is executed, it can affect how items are counted or block the count()
.
The original query as defined by count()
.
Contextual information about the hook.