title: Find and Replace Strings in Documents Efficiently
body: <p>I have the following query, to find <code>&amp;nbsp;</code> tags in a name field and replace them with an empty space - to get rid of them.<br>
  Name strings can have 1 to many <code>&amp;nbsp;</code> tags e.g. </p>
  
  <pre><code>AA&amp;nbsp;aa
  AA&amp;nbsp;&amp;nbsp;aa
  AA&amp;nbsp;&amp;nbsp;&amp;nbsp;aa
  AA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;aa
  AA&amp;nbsp;AA&amp;nbsp;aaaaaaaa
  </code></pre>
  
  <p>... like that.</p>
  
  <pre><code>  db.tests.find({'name':/.*&amp;nbsp;.*/}).forEach(function(test){
        test.name = test.name.replace("&amp;nbsp;","");
        db.tests.save(test);
     });
  
     db.tests.find({'name':/.*&amp;nbsp;&amp;nbsp;.*/}).forEach(function(test){
        test.name = test.name.replace("&amp;nbsp;&amp;nbsp;","");
        db.tests.save(test);
     });
  
    db.tests.find({'name':/.*&amp;nbsp;&amp;nbsp;&amp;nbsp;.*/}).forEach(function(test){
        test.name = test.name.replace("&amp;nbsp;&amp;nbsp;&amp;nbsp;","");
        db.tests.save(test);
     });
  </code></pre>
  
  <p>Other than repeating the same query pattern, is there a better solution to handle this scenario, in terms of less duplication and higher performance?</p>