title: MongoDB query to retrieve distinct documents by date
body: <p>I have documents in the database with a dateTime value like so:</p>
  
  <pre><code>{
      "_id" : ObjectId("5a66fa22d29dbd0001521023"),
      "exportSuccessful" : true,
      "month" : 0,
      "week" : 4,
      "weekDay" : "Mon",
      "dateTime" : ISODate("2018-01-22T09:02:26.525Z"),
      "__v" : 0
  }
  </code></pre>
  
  <p>I'd like to:</p>
  
  <ol>
  <li><p>query the database for a given date and have it return the document that contains the dateTime if the date matches (I don't care about the time). This is mainly to test before inserting a document that there isn't already one for this date.  In the above example, if my given date is <code>2018-01-22</code> I'd like the document to be returned.</p></li>
  <li><p>retrieve all documents with a distinct date from the database (again, I don't care about the time portion). If there are two documents with the same date (but different times), just return the first one.</p></li>
  </ol>
  
  <p>From what I understand Mongo's ISODate type does not allow me to store only a date, it will always have to be a dateTime value. And on my side, I don't have control over what goes in the database.</p>