Skip to content

Commit

Permalink
DBCollection.distinctAndCount on multiple fields documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielelana committed Aug 5, 2014
1 parent 8472285 commit 796addd
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,21 @@ For each distinct value of `field` counts the occurrences in documents optionall
"Adalberto": 5,
"Adela": 1,
...
]
}
```
The `field` parameter could be an array of fields
```js
> db.users.distinctAndCount(['name','job'], {name: /^a/i})
{
"Austin,Educator" : 1,
"Aurelia,Educator" : 1,
"Augustine,Carpenter" : 1,
"Augusta,Carpenter" : 2,
"Audreanne,Zoologist" : 1,
"Audreanne,Farmer" : 1,
"Aubree,Lawyer" : 1,
...
}
```

<a name="Collection-first" />
Expand Down

0 comments on commit 796addd

Please sign in to comment.