Answer the question
In order to leave comments, you need to log in
How to organize data upload on Node.js?
There is an API on Express.js (database on MongoDB) and a client - CMS on Angular.js. It is necessary to organize on the client the unloading of data from one of the collections (about 100k records) with saving to a CSV file. How best to implement this?
Answer the question
In order to leave comments, you need to log in
We read from mongi with a stream (like this: MyCollection.find({}).sort({}).stream()
), then after simple transformations, we either write to a file (also with a stream) and then give it to nginx, or immediately give it to the browser. The first option is good because the result can be cached, and nginx is still more efficient than the node in such things, the second is stupidly simpler.
PS in principle, it is possible without streams - if there is a lot of memory on the server :)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question