Skip to content

Latest commit

 

History

History
21 lines (18 loc) · 433 Bytes

File metadata and controls

21 lines (18 loc) · 433 Bytes

Collection of interesting things

Count of entries by day

This is formatted for mongo cli. Adapting to python should be pretty easy

db.entries.aggregate([
    {
        '$project': {
            count: {'$dateToString': {format: '%Y-%m-%d', date: '$date'}}
        }
    }, {
        '$group': {
            _id: {count: '$count'},
            viewCount: {'$sum': 1}
        }
    },
    {'$sort': {'_id.count': 1}}
])