title: MongoDB: Converting field type from String to Array
body: <p>I used mongoimport to import an csv file. This dataset to be specific:</p>
  
  <p><a href="https://www.google.com/fusiontables/DataSource?docid=1d7Qps--r0i-E4drYQQzntSdXN8xJ4-6qk24CiMed#map:id=3" rel="nofollow">https://www.google.com/fusiontables/DataSource?docid=1d7Qps--r0i-E4drYQQzntSdXN8xJ4-6qk24CiMed#map:id=3</a></p>
  
  <p>The problem I am having is with the <code>description</code> field. </p>
  
  <pre><code>[{"landing_point_id":3522,"latlon":"51.898325,-8.472768","name":"Cork, Ireland"}]
  </code></pre>
  
  <p>I figure this is an array of objects so I am making a mongoose model for it like this:</p>
  
  <pre><code>  description: [{
      landing_point_id: Number,
      latlon: String,
      name: String
          }],
  </code></pre>
  
  <p>But this gives me an empty array. If I set the type of <code>description</code> to <code>String</code> I do get the values – but of course as a string, so the properties are not accessible. </p>
  
  <pre><code>"description" : "[{\"landing_point_id\":8398,\"latlon\":\"52.207114,1.620294\",\"name\":\"Sizewell, United Kingdom\"}]"
  </code></pre>
  
  <p>So the problem seem to be that the field <code>description</code> is a <code>String</code> when I would like it to be an <code>Array</code>.</p>
  
  <p>Following answers on here I have tried to convert it from string to array, but with no luck. </p>
  
  <pre><code>db.cables.find().snapshot().forEach(function (el) {
    el.description_array = [ el.description ];
    db.cables.save(el);
  });
  </code></pre>
  
  <p>This just wraps the string in another array.</p>
  
  <pre><code>"description_array" : [ "[{\"landing_point_id\":8398,│    col10: '',
  \"latlon\":\"52.207114,1.620294\",\"name\":\"Sizewell, United Kingdom\"}]" ]
  </code></pre>
  
  <p>And the same for </p>
  
  <pre><code>  el.description_array = new Array(el.description);
  </code></pre>
  
  <p>Any ideas how to solve this?</p>
  
  <p>Something that could be edited in the csv file before importing to make mongoimport interpret it correctly?</p>