0

我试图让我的 mongo 查询执行部分和不区分大小写的匹配。我目前正在这样做

bson.M{"$regex": primitive.Regex{Pattern: regexp.QuoteMeta(school), Options: "i"}

学校是类型interface所以我收到这个错误 -

Cannot use school (variable of type interface{}) as string value in argument to regexp.QuoteMeta

我该如何解决?

4

0 回答 0