Skip to content

Instantly share code, notes, and snippets.

@dansteingart
Created March 9, 2012 03:00
Show Gist options
  • Save dansteingart/2004796 to your computer and use it in GitHub Desktop.
Save dansteingart/2004796 to your computer and use it in GitHub Desktop.
Node Script for MongoExport
var exec = require('child_process').exec;
var child;
//Put path to mongoexport here
mel = "/Users/ardustat/Downloads/mongodb-osx-x86_64-2.0.2/bin/mongoexport"
function mongoexport(collection)
{
out_string = mel + " -csv -o "+collection+".csv -d ardustat -c "+collection+" -f time,cell_potential,working_potential,current"
child = exec(out_string, function (error, stdout, stderr)
{
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
})
}
mongoexport(process.argv[2])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment