These are chat archives for Automattic/mongoose

21st
Sep 2017
Sathish Kumar
@sathisz
Sep 21 2017 11:27
Any one say whats wrong in this
db.getCollection('AuditLogs').aggregate(
    {
        $group:{
                _id: { "created": { $subtract: [ "$created",‌​{ $add:[{ $multiply: [{‌​ $second:"$created"},‌​1000]},{$millisecond‌​:"$created"}]}]}}
               }
    }
)
Scott Gilroy
@sgilroy
Sep 21 2017 18:20
@sathisz It looks like that text contains several non-printing diacritics. Try removing them with your text editor or http://utils.paranoiaworks.org/diacriticsremover/. Other than that, the aggregation appears to remove seconds and milliseconds from the created field of AuditLogs correctly. Here is your aggregation again with non-printing characters removed:
db.getCollection('AuditLogs').aggregate(
    {
        $group:{
                _id: { "created": { $subtract: [ "$created",{ $add:[{ $multiply: [{ $second:"$created"},1000]},{$millisecond:"$created"}]}]}}
               }
    }
)