数据结构
查询
更新
替换更新值的部分内容
db.getCollection("interface").find({ project_id: 167 }).forEach(function(rep) { a = rep.path; print("原字段:" + a); b = a.replace("AAAAA", "BBBBB"); rep.path = b; db.getCollection("interface").update({ _id: rep._id }, { $set: { path: b } }); c = rep.path; print("替换后后后:" + c); })
参考:https://wenku.baidu.com/view/4a7c57c2bbf67c1cfad6195f312b3169a451ea93.html