title: MongoDB: changing document structure query
body: <p>We have made a change in our data model and we would like to apply it to all documents in one of our collections:</p>
  
  <pre><code>{
    "id":60,
    "measurement":{
      "steps":1274.0
    },
    "date":"2012-05-15T00:00:00Z"
  }
  </code></pre>
  
  <p>to:</p>
  
  <pre><code>{  
    "id":60,
    "measurement":{
        "distance":{
            "steps":1274.0}
        },
    "date":"2012-05-15T00:00:00Z"
  }
  </code></pre>
  
  <p>Essentially, we want to further nest the field <code>steps</code>, placing it under the <code>distance</code> field.</p>
  
  <p>As for <code>measurement.step</code>, we would like to convert <code>measurement.miles</code> to <code>measurement.distance.miles</code> and <code>measurement.minutes</code> to <code>measurement.time.minutes</code>.</p>
  
  <p>Any thoughts and/or suggestions would be appreciated.</p>