golang - upper.io/db/mongo是否支持正则表达式查询?

浏览:77日期:2023-06-29

问题描述

RT https://godoc.org/upper.io/db/mongo 提供了个find函数,然而我想进行模糊匹配。func (self *Collection) Find(terms ...interface{}) db.Result试图通过下列方法传参

temp := map[string]string{'$regex:': '.*', }count, _ := col.Find(db.Cond{'url': temp}).Count()

然而并不能进行正则匹配

问题解答

回答1:

为什么你的 $regex 后面还有个 : 冒号?

相关文章: