title: Mongo - Replace all occurrences of a String
body: <p>I have a Mongo database collection, with _id and value as the two keys. What I'm trying to accomplish is to search all the documents in my collection for occurrences of a specific string and replace that with a new string.</p>
  
  <pre><code>{
      "_id" : "12345678",
      "value" : "Lorem ipsum"
  }
  </code></pre>
  
  <p>Also, extending it further, can I accomplish the same when I have a nested document structure?</p>
  
  <pre><code>{
      "_id" : "12345678",
      "someKey" : {
          "value1" : "Lorem ipsum",
          "value2" : "Lorem ipsum"
          }
  }
  </code></pre>