While working on a node JS project, I had the need to pull certain data from my database and represent values in a CSV file, This guide aims at sim...
For further actions, you may consider blocking this person and/or reporting abuse
Actually, I'm not a Front End dev, and my knowledge of js and node is quite a little, but I can help you to improve your solution.
Postgres has a very nice feature called "COPY FROM". It can copy any data from your database in the CSV format with the header as well.
So basically you don't need to have a json_to_converter and any orm at all.
Just using the "COPY TO STDOUT" and js streams you are able to build a very powerful and nice solution, which will help you to get any data from the database no matter how it will be large in size. you will be limited only with your bandwidth.
Thank you, Alex, Yeah sure an ORM is not necessary, I would surely try out the alternate solution suggested.
You should also streaming, especially if CSV is large.
Maybe by piping CSV stream.
Hello, I love the article. But I do have some questions.
In a situation where I gotten the data I need from mongodb and I applied .populate
However, I would like to get access to a certain field in the populated field. How do I do that.
Hello Joel, hope I’m not too late, if you use populate then you would have a nested object, the library supports dots notation, for example, you have a user object with Id key, it would be value: 'user.id'
This was very helpful David, Thanks. Just wondering how it will be handled in the frontend.
From the frontend, it can be sent as Formdata payload
Thank you!
This is awesome! Thanks David 😁
Nice read!!
Thank you this is really helpful!
This is beautiful... thanks
Much needed one for me. Thanks :)
Thanks, it was really helpful
thanks!! very helpfull
how can i set the file to be support hebrew lang? when download the file its look like
%$#@$R@F
thanks
Hello, I am not quite sure, it depends on how the data is stored in the database.