Getting the number of unique values of a query <p>I have some documents with the following structure:</p> <pre><code>{ "_id": "53ad76d70ddd13e015c0aed1", "action": "login", "actor": { "name": "John", "id": 21337037 } } </code></pre> <p>How can I make a query in Node.js that will return the number of the unique actors that have done a specific action. For example if I have a activity stream log, that shows all the actions done by the actors, and a actorscan make a specific action multiple times, how can I get the number of all the unique actors that have done the "login" action. The actors are identified by actor.id </p>