假设这
c是您的收藏夹:
pipe := c.Pipe([]bson.M{{"$match": bson.M{"name":"John"}}})resp := []bson.M{}err := pipe.All(&resp)if err != nil { //handle error}fmt.Println(resp) // simple print proving it's workingGoDoc参考:
- Collection.Pipe文档
- 管道及其方法

假设这
c是您的收藏夹:
pipe := c.Pipe([]bson.M{{"$match": bson.M{"name":"John"}}})resp := []bson.M{}err := pipe.All(&resp)if err != nil { //handle error}fmt.Println(resp) // simple print proving it's workingGoDoc参考: