title: MongoDb - Change type from Int to Double
body: <p>We have a collection that looks like this:</p>
  
  <pre><code>{
      "_id" : "10571:6",
      "v" : 261355,
      "ts" : 4.88387e+008
  }
  </code></pre>
  
  <p>Now, some of the "v" are ints, some are doubles. I want to change them all to doubles.</p>
  
  <p>I've tried a few things but nothing works (v is an int32 for this record, I want to change it to a double):</p>
  
  <pre><code>db.getCollection('VehicleLastValues')
  .find
  (
  
      {_id : "10572:6"}
  )
  .forEach
  (
  function (x)
  {
      temp = x.v * 1.0;
      db.getCollection('VehicleLastValues').save(x);
  }}
  </code></pre>
  
  <p>Things I've tried:</p>
  
  <pre><code>x.v = x.v * 1.1 / 1.1;
  x.v = parseFloat (new String(x.v));
  </code></pre>
  
  <p>But I can't get it to be saved as a double...</p>