I want to replace a substring "are" with "any test" in all "ques" document of "user" collection,but my query is replace the full document string with "any test".I am new to mongo. Please someone suggest me what wrong with my query?
Here is my mongo query.
db.user.find({ques:{$regex:'are'}}).forEach(function (e, i) {e.ques = e.ques.replace(/are/, 'any test'), printjson(e); db.ques.save(e);} )