Call mongoexport from javascript Node.js

↘锁芯ラ 提交于 2019-12-11 10:28:19

问题


I would like to export a Mongo Collection to an .csv. Mongo provides a solution for this but it is limited to the shell.

http://docs.mongodb.org/manual/reference/mongoexport/

I'm using the native driver for node.js and would like to be able to do this in a script as opposed to being invoked from the shell.


回答1:


If you're just looking to run the mongoexport command from your node.js app, you can use child_process.spawn to do that.




回答2:


You can script the shell. Check this out. Might help.

http://www.mongodb.org/display/DOCS/Scripting+the+shell



来源:https://stackoverflow.com/questions/13041648/call-mongoexport-from-javascript-node-js

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!