title: Why does exporting data to CSV give only numbers?
body: <p>I am trying to export a mongo strucuture to CSV with the following code:</p>
  
  <pre><code>file = Tempfile.new(['genreport','.csv'],file_path)
  file_name = file.path()
  CSV.open(file_name,"w") do |csv|
  result_cursor.each do |eachdoc|
      eachdoc.each do |key,value|
          csv&lt;&lt;key.to_s
          csv&lt;&lt;value.to_s
      end
      csv&lt;&lt;"\n"
  end
  end
  </code></pre>
  
  <p>The CSV file is created as expected, but it is full of numbers only. What am I doing wrong?</p>
  
  <p>Here are the types:</p>
  
  <p><code>result_cursor</code> is a mongo cursor, <code>eachdoc</code> will be a hash, and <code>key</code> and <code>value</code> will be a String.</p>