title: Mongodb: updating a variable field name
body: <p>I want to add a new field with a variable name to an object in the DB : meaning, I don't know the name of the field, but it's held in a variable "newFieldName". </p>
  
  <p>So what I want to do is basically this:</p>
  
  <pre><code>var newFieldName = "world";
  db.bios.update(
     { _id: 3 },
     { $set: {
               "hello."+newFieldName: "Amazing Grace"
             }
     }
  )
  </code></pre>
  
  <p>After the update, I expect the object "hello" to have a field "world" with the value "Amazing Grace". </p>
  
  <p>but this doesn't even compile, let alone work. How can I do it?</p>