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.
for instance
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 => line[0], :ang => line[1], :pro => line[2])
#e.g. line[0] => 45nm, line[1] => 180, line[2] => 3
end
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.
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?
Thanks for your help