title: Update a field only if it exists in MongoDB
body: <p>I have a document in collection testcol in MongoDB like this :</p>
  
  <pre><code>{
  _id:111,
  "xxx":"aaa",
  "yyy":"bbb"
  }
  </code></pre>
  
  <p>I want to update the field yyy in the document, if the field is found then update it and if the field is not found then don't do anything.</p>
  
  <p>When I am running my mongo db update command like <code>db.testcol.update({_id:0},{$set:{"zzz":"ccc"}},{upsert: false})</code>. Intentionally I gave the field as "zzz" in the update command so that it shouldn't do anything. But when I run the above update command, it inserted the new field "zzz" in the above document although upsert was given false. I know upsert will not/will insert document and not field , but since I am new to MongoDB I was just giving it a try. Can anyone please let me know how to approach this issue?</p>