我想通过使用来求和一个字段
pipeline := []bson.M{
bson.M{"$group": bson.M{
"_id": "",
"count": bson.M{ "$sum": 1}}}
}
ctx, _ := context.WithTimeout(context.Background(), 5*time.Second)
result, err := collection.Aggregate(ctx, pipeline)
但它总是会回来
"Current": null
有什么解决办法吗?
UYOU
相关分类