@@ -10,9 +10,33 @@ Aggregations operations process data records and return computed results. Aggreg
1010
1111There are two functions you can use:
1212
13- [ db.collection.count()] ( https://docs.mongodb.com/manual/reference/method/db.collection.count/#db.collection.count )
13+ #### [ db.collection.count()] ( https://docs.mongodb.com/manual/reference/method/db.collection.count/#db.collection.count )
1414
15- [ db.collection.distinct()] ( https://docs.mongodb.com/manual/reference/method/db.collection.distinct/#db.collection.distinct )
15+ syntax
16+ ```
17+ db.collection.count(query, options)
18+ ```
19+
20+
21+ | Parameter | Description |
22+ | --- | --- |
23+ | query | The query selection criteria.
24+ | options | Optional. Extra options for modifying the count.
25+
26+
27+ #### [ db.collection.distinct()] ( https://docs.mongodb.com/manual/reference/method/db.collection.distinct/#db.collection.distinct )
28+
29+ syntax
30+ ```
31+ db.collection.distinct(field, query, options)
32+ ```
33+
34+
35+ | Parameter | Description |
36+ | --- | --- |
37+ | field | The field for which to return distinct values.
38+ | query | A query that specifies the documents from which to retrieve the distinct values.
39+ | options | Optional. A document that specifies the options. See Options.
1640
1741### examples - count()
1842```
@@ -45,18 +69,6 @@ db.inventory.insert([
4569
4670### examples - distinct()
4771
48- syntax
49- ```
50- db.collection.distinct(field, query, options)
51- ```
52-
53-
54- | Parameter | Description |
55- | --- | --- |
56- | field | The field for which to return distinct values.
57- | query | A query that specifies the documents from which to retrieve the distinct values.
58- | options | Optional. A document that specifies the options. See Options.
59-
6072```
6173db.inventory.distinct( "dept" )
6274```
0 commit comments