-
Type: Task
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 1.0.3
-
Component/s: BSON
-
Labels:None
-
Environment:macOS Mojave 10.14.2
aggQuery := []bson.M{{ "$group": bson.M{ "_id": "$created_at", "play_sum": bson.M{ "$sum": "$play_num", }, "comment_sum": bson.M{ "$sum": "$comment_num", }, }, "$match": []bson.M{{ "vid": bson.M{ "$in": bson.A{ "...", "....", }, }, }}, }} cursor, err := myCollection.Aggregate(ctx, aggQuery)
i try it not work, error message:
2019/08/11 18:56:52 (Location40323) A pipeline stage specification object must contain exactly one field.
but i replace `aggQuery`:
aggQuery := []bson.M{{ "$group": bson.M{ "_id": "$created_at", "play_sum": bson.M{ "$sum": "$play_num", }, "comment_sum": bson.M{ "$sum": "$comment_num", }, }, }}
is working.