title: Replacing embedded document in array in MongoDB
body: <p>Is there an easy way to replace an entire embedded document in an array? 
  Say replacing:</p>
  
  <pre><code>{
     "_id" : "2",
        "name" : "name2",
        "xyz..." : "xyz2..."
  }
  </code></pre>
  
  <p>with:</p>
  
  <pre><code>{
     "_id" : "2",
        "name" : "name6",
        "xyz..." : "xyz5..."
        "morefields..." : "fields..."
  }
  </code></pre>
  
  <p>Searching for _id (embedded). Or do I need to replace each field individually using $set?</p>
  
  <pre><code>{
    "_id" : "2",
    "users" : [{
        "_id" : "1",
        "name" : "name1",
        "xyz..." : "xyz1..."
      }, {
        "_id" : "2",
        "name" : "name2",
        "xyz..." : "xyz2..."
      }],
    "name" : "main name"
  }
  </code></pre>