我正在尝试从我的mongodb
收藏中检索随机记录。我正在使用golang
mongo -go-driver
pipeline := []bson.E{bson.E{"$sample", bson.E{"size", 10}}} collection.Aggregate(context.TODO(), pipeline)
聚合返回给我这个错误:
A pipeline stage specification object must contain exactly one field.
我试过$size
和size
有没有可能mongo-go-driver
不支持$sample?
BIG阳
相关分类