title: mass insert mongoid
body: <p>I have this web app currently on Heroku that takes plain text of mostly comma separated values (or other delimiter separated values) that a user copies-and-pastes into a web form, and the app will then get data from each line and save it to a mongo db.</p>
  
  <p>for instance</p>
  
  <pre><code>45nm, 180, 3
  44nm, 180, 3.5
  45nm, 90, 7
  ...
  
  @project = Project.first # project embeds_many :simulations
  @array_of_array_of_data_from_csv.each do |line|
    @project.simulations.create(:thick =&gt; line[0], :ang =&gt; line[1], :pro =&gt; line[2])
    #e.g. line[0] =&gt; 45nm, line[1] =&gt; 180, line[2] =&gt; 3
  end
  </code></pre>
  
  <p>For this app's purposes, I can't let the user do any kind of import, we have to get the data from them from a textarea. And each time, the user can paste upto 30,000 lines. I tried doing that (30,000 data points) on Heroku with some fake data in a console, it terminated saying long processes are not supported in console, try rake tasks instead. </p>
  
  <p>So I was wondering if anyone knows either way it takes so long to insert 30,000 documents (of course, it can be that's the the way it is), or knows another way to speedily insert 30,000 documents?</p>
  
  <p>Thanks for your help</p>