mongodb project replace string code example
Example: mongodb replace string
db.mycollection.find({}).forEach((doc, index) => {
doc.myStr = doc.myStr.replace('foo', 'bar');
db.mycollection.save(doc);
});
db.mycollection.find({}).forEach((doc, index) => {
doc.myStr = doc.myStr.replace('foo', 'bar');
db.mycollection.save(doc);
});