0

I have some raw text files with words. I want to insert those words into a local collection in mongodb. How does one read from a text file using a .js script? Whilst this is probably trivial I found no clear way of reading a local text file in javascript.

Edit: Just to be clear, the text files and the database are local.

thehousedude
  • 611
  • 6
  • 16
  • 1
    Reading file: http://nodejs.org/api/fs.html Storing file: http://stackoverflow.com/questions/14017826 –  Jul 16 '14 at 07:41
  • Thanks for the answer. One more thing: When doing multiple upserts of initial data (2-300k), is node.js faster than pymongo and why? – thehousedude Jul 17 '14 at 09:48
  • I do not think one will be significantly faster than the other. You just need to give it a try. –  Jul 17 '14 at 10:43

0 Answers0