Returns the distinct values that match the query, without duplicates.
The distinct()
function 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
functions used to refine the query is invalid.
Notes:
suppressAuth
option to true
.distinct()
returns the full distinct items that match the query. To specify which fields to return for each retrieved item, use the fields()
method.
The property whose value will be compared for distinct values.
An object containing options to use when processing this operation.