title: Querying embedded documents by matching dates in MongoDB
body: <p>I have a database containing emails and I want to search for a specific date using the <code>regex</code> operator and return all emails sent on that date. I have tried this so far but it doesn't return anything. I am new to regex and am not sure if I'm querying the date correctly.</p>
  
  <pre><code>db.messages.find({'headers.Date' : $regex : '2001-07-06'}})
  </code></pre>
  
  <p>This example below successfully returned all the emails send from the specified email address.</p>
  
  <pre><code>db.messages.find({'headers.From' : { $regex : 'reservations@merriotts.com' } });
  </code></pre>
  
  <p>The emails contain the following information:</p>
  
  <pre class="lang-none prettyprint-override"><code>headers { content transfer encoding, content type, date, from, message id, mime version, subject, to }
  </code></pre>