title: Mongodb aggregate by day and delete duplicate value
body: <p>I'm trying to clean a huge database.</p>
  
  <p>Sample DB :</p>
  
  <pre><code>{
    "_id" : ObjectId("59fc5249d5ab401d99f3de7f"),
    "addedAt" : ISODate("2017-11-03T11:26:01.744Z"),
    "__v" : 0,
    "check" : 17602,
    "lastCheck" : ISODate("2018-04-05T11:47:00.609Z"),
    "tracking" : [
    {
        "timeCheck" : ISODate("2017-11-06T13:17:20.861Z"),
        "_id" : ObjectId("5a0060e00f3c330012bafe39"),
        "rank" : 2395,
    }, 
    {
        "timeCheck" : ISODate("2017-11-06T13:22:31.254Z"),
        "_id" : ObjectId("5a0062170f3c330012bafe77"),
        "rank" : 2395,
    }, 
    {
        "timeCheck" : ISODate("2017-11-06T13:27:40.551Z"),
        "_id" : ObjectId("5a00634c0f3c330012bafebe"),
        "rank" : 2379,
    }, 
    {
        "timeCheck" : ISODate("2017-11-06T13:32:41.084Z"),
        "_id" : ObjectId("5a0064790f3c330012baff03"),
        "rank" : 2395,
    }, 
    {
        "timeCheck" : ISODate("2017-11-06T13:37:51.012Z"),
        "_id" : ObjectId("5a0065af0f3c330012baff32"),
        "rank" : 2379,
    }, 
    {
    "timeCheck" : ISODate("2017-11-07T13:37:51.012Z"),
    "_id" : ObjectId("5a0065af0f3c330012baff34"),
    "rank" : 2379,
    }]
  }
  </code></pre>
  
  <p>I have a lot of duplicate value but I need to clean only by day.
  To obtain this for example :</p>
  
  <pre><code>{
    "_id" : ObjectId("59fc5249d5ab401d99f3de7f"),
    "addedAt" : ISODate("2017-11-03T11:26:01.744Z"),
    "__v" : 0,
    "check" : 17602,
    "lastCheck" : ISODate("2018-04-05T11:47:00.609Z"),
    "tracking" : [
    {
        "timeCheck" : ISODate("2017-11-06T13:17:20.861Z"),
        "_id" : ObjectId("5a0060e00f3c330012bafe39"),
        "rank" : 2395,
    }, 
    {
        "timeCheck" : ISODate("2017-11-06T13:27:40.551Z"),
        "_id" : ObjectId("5a00634c0f3c330012bafebe"),
        "rank" : 2379,
    }, 
    {
    "timeCheck" : ISODate("2017-11-07T13:37:51.012Z"),
    "_id" : ObjectId("5a0065af0f3c330012baff34"),
    "rank" : 2379,
    }]
  }
  </code></pre>
  
  <p>How can I aggregate by day and after delete last value duplicate?
  I need to keep the values per day even if they are identical with another day.</p>