title: How to update a document in a forEach-loop in Javascript using Monk?
body: <p>First the structure of my documents:</p>
  
  <pre><code>{
    "_id": "541a8bea74123744b371d38e",
    "geometry": {
      "type": "Point",
      "coordinates": [
        5.3435,
        51.69554
      ]
    },
    "type": "Feature",
    "properties": {
    }
  }
  </code></pre>
  
  <p>The thing is I want to add a  field using the update function in a forEach loop. The loop works, I can iterate over every document in the collection but the update function does nothing. This is what I have:</p>
  
  <pre><code>var counter = 0;
  collection.find({}, {
      stream: true
    })
    .each(function(doc) {
      counter++;
      var hash = geohash.encode(doc.geometry.coordinates[1], doc.geometry.coordinates[0], precision = 9);
      console.log("id: " + doc._id + " hash: " + hash + " counter= " + counter);
      collection.update({
          _id: doc._id
        }, {
          $set: {
            "properties.geohash.precision9": hash
          }
        },
        function(err) {
          if (err) console.log(err);
        }
      );
    })
    .error(function(err) {
      // handle error
      console.log(err);
    })
    .success(function(doc) {
      // final callback
      console.log("added geohash");
      res.send({
        objects: doc
      });
    });
  </code></pre>
  
  <p>Where am I wrong?</p>