Mass user import or Mass Accounts.createUser()

I am trying to do as the title says. I am passing a json array of 35,000 user accounts from a previous website I am moving to meteor and want to import all the users over to meteor. Basically I am passing the json array into a for loop on the server side and iterating over a loop through the array performing an Accounts.createUser() each iteration for each user.

It appears to error out after a couple of thounsand users have passed into the database. Before that it functions correctly. The error appears to be in the ‘meteor-tool’. I will include a copy of the output at the end of the document. Is there any better way to perform this? Any advice would be appreciated.

Thanks,
Aedan.

error example: at next (C:\Users\Aedan\AppData\Local.meteor\packages\meteor-tool\1.4.0-1\mt-os.windows.x86_32\dev_bundle\lib\node_modules\eachline\eachline.js:141:4)
at Transformer._transform (C:\Users\Aedan\AppData\Local.meteor\packages\meteor-tool\1.4.0-1\mt-os.windows.x86_32\dev_bundle\lib\node_modules\eachline\eachline.js:158:2)
at Transformer.Transform._read (_stream_transform.js:167:10)
at Transformer.Transform._write (_stream_transform.js:155:12)
at doWrite (_stream_writable.js:300:12)
at writeOrBuffer (_stream_writable.js:286:5)
at Transformer.Writable.write (_stream_writable.js:214:11)
at Socket.ondata (_stream_readable.js:542:20)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:153:18)
at Socket.Readable.push (_stream_readable.js:111:10)
at Pipe.onread (net.js:536:20)

Although 35,000 users sounds like a pretty big JSON, have you checked if the file is proper JSON? (For example with JsonLint)

Although, can you confirm if the application runs out of memory or something?

I have been importing thousands of records already with the same method, and those are the two things that gave me errors at first. After fixing the JSON and stocking up memory, everything worked fine.

Hi @yann2006 ,

Just to let you know. The problem was just that I was logging in the console every insert and I think that was causing a memory overload. Works if I don’t log anything.

Cheers.