mongo-to-csv
Export the mongodb collection to csv using mongoexport and nodejs
Usage
1. $ npm install mongo-to-csv --save
'use strict';const mongotocsv = ;let options = database: 'users' // required collection: 'pets' // required fields: 'name''cost' // required output: './output/pets.csv' // required allValidOptions: '-q \'{ "name": "cat" }\'' // optional;mongotocsv;
This libaray uses the mongoexport
command provided by mongodb and execute command through nodejs child_process
allValidOptions
property.
you can pass all the available options of mongoexport command here through Run test
- clone the repo
$ git cone https://github.com/yasharma/mongo-to-csv.git
-
cd mongo-to-csv
-
npm install
-
npm test