title: How to use distinct/aggregate to get all fields that match several queries
body: <p>I just learned how to use distinct.</p>
  
  <p>What I do is create a BasicDBObject, put as query parameter to distinct what I want to be equal, and as field parameter what I want returned.</p>
  
  <p>Now I want to do something similar, but with several queries. That meaning, I want the query to match several keys of the document (id and date have to be the same as the input I get), and return what sessions match that in the collection.</p>
  
  <p>I tried doing something similar to find, but for distinct, where you add with append() or put() more fields to the query parameter. </p>
  
  <p>This syntax does not seem to work and I found no one using similar code, so I guess it's not possible.</p>
  
  <p>I've found the aggregate() method, but it seems to be used to match several FIELDS, not queries. Explanation with code:</p>
  
  <pre><code>array.put(coll.distinct(field, query));
  </code></pre>
  
  <p>I want that query parameter to have several keys, so that all fields match my input, and I find unique values of field that match both (or as many) keys in query.</p>
  
  <p>Thanks in advance!</p>
  
  <p>Edit:</p>
  
  <p>Basics: MongoDB 3.2.2</p>
  
  <p>Data manipulation: </p>
  
  <pre><code>"Session" : "value1", "car" : "carNumber", "date" : "20130321"
  </code></pre>
  
  <p><strong>I have a very large collection with a number of documents that have, among other keys, this ones. I want, given a car and a number, get every UNIQUE session value</strong>, and return it as a json (for which, so far, I put the values into an array, and transform into json).</p>
  
  <p>driver/framework specific question: I do not know to query this in mongodb shell. I know to use distinct, but not aggregators.</p>