title: How do I update a document inside a forEach() loop?
body: <p>I'm trying to update all documents inside a <code>forEach()</code> loop, but the update isn't occurring. I'm logging each iteration to make sure the <code>forEach()</code> is working, and it is. But, for some reason the <code>update()</code> is not working.</p>
  
  <p>Here is my code:</p>
  
  <pre><code>myModelSchema.methods.updateMyModel = function (cb) {
  var myModel = this.model('MyModel');
  
  myModel.find({}, function (err, items) {
      items.forEach(function (item) {
          console.log('item._id = ' + item._id);
          myModel.update(
              {
                  _id: item._id
              },
              {
                  $set: {
                      "some_array.0.some_field": item.some_field
                  }
              }
          );
      })
  });
  };
  </code></pre>
  
  <p>As noted above, I see the <code>console.log()</code>, but the documents are not being updated. What am I doing wrong?</p>