robbiblubber.org

help | login | search:  
<<

Home Page
Index

Projects

Utility Suite
Data Suite
Bad Wolf Suite
WeakWiki

User Docs

ConfigNotepad
LED
rqoon
Nuub

Code Docs

.NET
Java
PHP

robbiblubber.org

Specs
Articles

Sources















read  source  history 


= distinct() =
----
[[MongoDB Driver Function Reference]]


Retrieves distinct field values from documents matching the filter criteria from a collection.
More information can be found in the corresponding entry of the [[https://docs.mongodb.com/manual/reference/method/db.collection.distinct/index.html|MongoDB Manual]].


[[[@cG

<collection>.distinct(<field>[, <filter>[, <options>]])

]]]


**Arguments**

[[[@w

|@t0@r0@c0 <collection> | | The target collection. |
| <field> | | The field name. |
| <filter> | | A filter expression using [[https://docs.mongodb.com/manual/reference/operator/|query operators]]. |
| <options> | | A BOSN document specifying options. |

]]]


**Options**

[[[@cw

{ maxTime: <long>, collation: <document> }
<<@f:text>>
|@t0@r0@c0 maxTime | | Sets the maximum operation time (in milliseconds). |
| collation | | A document specifying the [[https://docs.mongodb.com/manual/reference/bson-type-comparison-order/#collation|collation]]. |
<<@/f>>
]]]


**Return Value**

[[[@w

Returns a result set (cursor).

]]]


**Example**

[[[@cw

db.employees.distinct("age", { salary: { $gt: 700000 }});

]]]

Returns a distinct list of ages from the //employee// collection with a salary greater than 700000.



----
[[Main|home]] | [[MongoDB Driver Function Reference]] | [[MongoDB Driver]]