This API is subject to change. Bug fixes and new features will be released based on developer feedback throughout the preview period.
Returns the distinct values that match the query, without duplicates.
The distinct()
method returns a Promise that resolves to:
Unlike find()
, which returns all item objects that match the query, distinct()
returns matching field values,
and eliminates duplicate field values from the query result. You cannot use find()
and distinct()
together.
For an item to be resolved as distinct, only the specified field must be distinct. Other fields for that item in the collection are not evaluated when resolving the promise.
The Promise is rejected if distinct()
is called with incorrect permissions or if any of the
methods used to refine the query is invalid.
Note: Only site visitors with Data Read permissions can retrieve and view data. You can override the permissions by calling this method with elevated permissions.
Field whose value is compared for distinct values.
Configuration options for building the query.