douqian1835
2019-01-20 11:32
浏览 781
已采纳

如何使用mongo-go-driver 0.2.0在bson.A中使用切片的元素

How do I use a given slice to generate a bson.A? I need this to make dynamic queries.

I am upgrading from mongo-go-driver alpha to beta 0.2.0, and this has become a major change in my project since the API is different now.

https://godoc.org/github.com/mongodb/mongo-go-driver/bson

input := []string{"bar", "world"}
//expected output
bson.A{"bar", "world"}

图片转代码服务由CSDN问答提供 功能建议

如何使用给定的切片生成bson.A? 我需要用它来进行动态查询。</ p>

我正在从mongo-go-driver alpha升级到beta 0.2.0,由于API不同,这已成为我项目中的重大更改。 现在。</ p>

https:/ /godoc.org/github.com/mongodb/mongo-go-driver/bson </ p>

  input:= [] string {“ bar”,“ world”  } 
 //预期输出
bson.A {“ bar”,“ world”} 
 </ code> </ pre> 
 </ div>

2条回答 默认 最新

相关推荐 更多相似问题