title: MongoDB Collection with Non-repeated field value
body: <p>So I'm rather new to MongoDB. Here is an imaginary database with the following format. </p>
  
  <pre><code>{
      "_id": "message_id", 
      "headers": {
          "from": &lt;from_email&gt;,
          "to": &lt;to_email&gt;, 
          "timestamp": &lt;timestamp&gt;
      },   
      "message": {
          "message": &lt;the message contents&gt;, 
          "signature": &lt;signature contents&gt;
      }
  } 
  </code></pre>
  
  <p>Suppose all emails received are inserted into it and sometimes emails are double sent. How can one return a collection of emails from an author without any double sends. </p>
  
  <p>I thought this might do it but it doesn't seem to work as expected:</p>
  
  <pre><code>db.mycoll.find({"headers.from": &lt;authorname&gt;}).distinct("message.message")
  </code></pre>
  
  <p>Edit: 
  Please excuse me, It seems I have been making some kind of typo, the above query works, but it only returns messages.messages without the Headers, How would I keep the headers intact as well? </p>