Finds the distinct values for a specified field across a single collection and returns the results in an array.
-
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)
A promise
users.distinct('name')