beforeQuery() hook runs when:
find function is called.
- An action is performed on a dataset that retrieves items from the collection.
- The collection is viewed in the Content Manager.
- An item is imported into the collection. (Sandbox only.)
- An item is exported from the collection. (Sandbox only.)
The hook also runs when an action is performed on a dataset that retrieves
items from the collection that the dataset is connected to.
Return a query or a Promise that resolves to a query from the
function. The returned query will be used as the query for the
Often, you will modify the query that is received in the
by calling one or more
If the returned value is of the wrong type, the value is ignored.
A rejected Promise blocks the call to
and also calls the
onFailure() hook if it has been registered.
beforeQuery() hook is called before
is executed, it can affect the query that is used to retrieve items
or block the