In MongoDB, the distinct aggregation command finds the distinct values for a specified field across a single collection.
It returns a document that contains an array of the distinct values, as well as an embedded document with query statistics and the query plan.