title: Find last record of each day
body: <p>I store data about my power consumption, each minute there is a new record, here is an example:</p>
  <pre><code>{&quot;date&quot;:1393156826114,&quot;id&quot;:&quot;5309d4cae4b0fbd904cc00e1&quot;,&quot;adco&quot;:&quot;O&quot;,&quot;hchc&quot;:7267599,&quot;hchp&quot;:10805900,&quot;hhphc&quot;:&quot;g&quot;,&quot;ptec&quot;:&quot;c&quot;,&quot;iinst&quot;:13,&quot;papp&quot;:3010,&quot;imax&quot;:58,&quot;optarif&quot;:&quot;s&quot;,&quot;isousc&quot;:60,&quot;motdetat&quot;:&quot;Á&quot;}
  </code></pre>
  <p>such that I have around 1440 records a day.</p>
  <p>How can I get the last record of each day?</p>
  <hr />
  <p>Note: I use mongodb in spring java, so I need a query like this:</p>
  <p>Example to get all measures  :</p>
  <pre><code>@Query(&quot;{ 'date' : { $gt : ?0 }}&quot;)
  public List&lt;Mesure&gt; findByDateGreaterThan(Date date, Sort sort);
  </code></pre>