collection.distinct
Finds the distinct values for a specified field across a single collection and returns the results in an array.
Arguments
field
(String): The field for which to return distinct values.[
query
] (String|ObjectId|Object): A query that specifies the documents from which to retrieve the distinct values.[
options
] (object)[
callback
] (function)
Returns
A promise
Example
users.distinct('name')