我在Mongo DB中有很多数据,我想基于String值进行查询,并且该值包含一个URL
"url" : "http://some-host/api/name/service/list/1234/xyz"
执行以下查询时,我得到了记录计数
db.mycollection.find({url:"http://some-host/api/name/service/list/1234/xyz"}).count()
我想获取所有与之匹配的记录
some-host/api/name/service/list/
我尝试使用下面的样品
db.mycollection.find({url:"some-host/api/name/service/list/"}).count()
获得零记录
db.mycollection.find({url:/.*"some-host/api/name/service/list/".*/}).count()
错误
db.mycollection.find({"url":/.*"some-host/api/name/service/list/".*/}).count()
错误
db.mycollection.find({"url":/.*some-host/api/name/service/list/.*/}).count()
错误
db.mycollection.find({"url":/.*some-host//api//name//service//list//.*/}).count()
知道了...
...
然后没有回应