title: Mongodb how to update element only if it equals a string x?
body: <p>So I am trying to do something like this:</p>
  
  <pre><code>DB.update({_id}, {$set: {name: 'Bar'}}); // Set name to Bar only if name is Foo
  </code></pre>
  
  <p>But I only want to update the name to 'Bar', given that the current name is 'Foo'. How to do this?</p>