Reputation: 671
I am not at all familiar with javascript and was hoping I could receive some help with a mongo update of a variable.
I have looked at the following question : Pass variables into mongo updates?
but was confused a bit with the looping and the syntax.
I have a field called "name": "MyName" I am looking for a way to get the following results using a mongo shell command: "name": "MyName Is" with a query as well
How would I do that? Is this a completely incorrect approach?
db.collection.update({"old_id":{$regex:".*_change.*"}}, {$set:{"name":"name" + " Is"}}, {multi:true})
Thanks!
Upvotes: 2
Views: 2221