1
0
mirror of https://github.com/mgerb/mywebsite synced 2026-01-10 18:02:51 +00:00

fixed end point ordering

This commit is contained in:
2016-09-16 20:06:20 +00:00
parent 5e5db2698d
commit d00d069744

View File

@@ -233,6 +233,10 @@ func GetUniqueSensorDates(sensor_location string) ([]Years, error){
err := c.Pipe([]bson.M{bson.M{"$match": bson.M{"location": sensor_location}},
bson.M{"$group": bson.M{"_id": "$year", "months": bson.M{"$addToSet": bson.M{"month": "$month", "monthname": "$monthname"}}}},
bson.M{"$project": bson.M{"year": "$_id", "months": "$months"}},
bson.M{"$unwind": "$months"},
bson.M{"$sort": bson.M{"months.month": -1}},
bson.M{"$group": bson.M{"_id": "$year", "months": bson.M{"$push": "$months"}}},
bson.M{"$project": bson.M{"year": "$_id", "months": "$months"}},
}).All(&d)