Using variables in MongoDB update statement

As per L. Norman's comment, I find using the [] for the field value works instead

collection = "my_collection"
db.getCollection(collection).find({}).forEach(function(doc) {
    var new_field = "new_field";
    var new_value = "new_value";

    db.getCollection(collection).update({_id: doc._id}, 
        {$set: {[new_field] : new_value}}) 
})

You can do it this way:

'blur .editable' : function () {
  var target = event.currentTarget.value;
  var field = event.currentTarget.name;

  var obj = {};
      obj[field] = target;
  Hostings.update( { _id: this._id },{ $set: obj } );
}

Javascrip objects can be accessed two ways:

object.attribute

or

object["attribute"]

if you use the second method you can access it with a variable