title: MongoDB: Updating documents using data from the same document
body: <p>I have a list of documents, each with lat and lon properties (among others).</p>
  
  <pre><code>{ 'lat': 1, 'lon': 2, someotherdata [...] } 
  { 'lat': 4, 'lon': 1, someotherdata [...] }
  [...]
  </code></pre>
  
  <p>I want to modify it so that it looks like this:</p>
  
  <pre><code>{ 'coords': {'lat': 1, 'lon': 2}, someotherdata [...]} 
  { 'coords': {'lat': 4, 'lon': 1}, someotherdata [...]}
  [...]
  </code></pre>
  
  <p>So far I've got this:</p>
  
  <pre><code>db.events.update({}, {$set : {'coords': {'lat': db.events.lat, 'lon': db.events.lon}}}, false, true)
  </code></pre>
  
  <p>But it treats the <em>db.events.lat</em> and <em>db.events.lon</em> as strings. How can I reference the document's properties?</p>
  
  <p>Cheers.</p>