Group result by 15 minutes time interval in MongoDb
There are a couple of ways to do this. The first is with Date Aggregation Operators, which allow you to dissect the “date” values in documents. Specifically for “grouping” as the primary intent: db.collection.aggregate([ { “$group”: { “_id”: { “year”: { “$year”: “$created_at” }, “dayOfYear”: { “$dayOfYear”: “$created_at” }, “hour”: { “$hour”: “$created_at” }, “interval”: … Read more