title: aggregate group by time of intervals of 15 minutes
body: <p>I'm trying to calculate average speed of data for 15 minutes. I get the result back, it contains average speed, but not sure it's correct and for 15 minute sets, also <code>minutes</code> is nil.</p>
  
  <pre><code>o3 := bson.M{
      "$group": bson.M{
          "_id": bson.M{
              "minute": bson.M{
                  "$subtract": []interface{}{
                      "$timestamp",
                      bson.M{
                          "$mod": []interface{}{
                              "$minute",
                              15,
                          },
                      },
                  },
              },
          },
          "averageSpeed": bson.M{
              "$avg": "$speed",
          },
      },
  }
  </code></pre>
  
  <p>Anyone done something similar or can help?</p>
  
  <p>EDIT: $timestamp field is ISODate format and Date type</p>
  
  <p>Thank you</p>