Skip to content

Latest commit

 

History

History
25 lines (14 loc) · 651 Bytes

distinct.md

File metadata and controls

25 lines (14 loc) · 651 Bytes

collection.distinct

Mongo documentation

Finds the distinct values for a specified field across a single collection and returns the results in an array.

Arguments

  1. field (String): The field for which to return distinct values.

  2. [query] (String|ObjectId|Object): A query that specifies the documents from which to retrieve the distinct values.

  3. [options] (object)

  4. [callback] (function)

Returns

A promise

Example

users.distinct('name')