当前位置 博文首页 > 闫玉林的博客:在Navicat里连接MongoDB,使用查询语句正则匹配修
// http://file.hnxf.huainan.gov.cn//584782d
db.contentMongoEO.find({
"_id":551494506
}).forEach(function(result){
var newstr=result.content;
newstr=newstr.replace(/http:\/\/file.hnxf.huainan.gov.cn\/\/584782d/g,"/oldfiles/xfjoldfiles/584782d");
print(newstr);
result.content=newstr;
db.contentMongoEO.save(result);
});
db.contentMongoEO.find({
'content':{'$regex':/http:\/\/file.hnxf.huainan.gov.cn\/\/584782d/}
}).forEach(function(result){
var newstr=result.content;
newstr=newstr.replace(/http:\/\/file.hnxf.huainan.gov.cn\/\/584782d/g,"/oldfiles/xfjoldfiles/584782d");
//print(newstr);
result.content=newstr;
db.contentMongoEO.save(result);
});
cs