Skip to content

Instantly share code, notes, and snippets.

@lukasz-kaniowski
Created July 12, 2017 14:07
Show Gist options
  • Select an option

  • Save lukasz-kaniowski/d3bb711eb6733f51a218559c3d2d73e4 to your computer and use it in GitHub Desktop.

Select an option

Save lukasz-kaniowski/d3bb711eb6733f51a218559c3d2d73e4 to your computer and use it in GitHub Desktop.
Streaming backup of mongodb 3.2
const fs = require('fs')
const writeStream = fs.createWriteStream('out.db')
const { spawn } = require('child_process');
const mongodump = spawn('mongodump', ['--archive', '--db', 'databaseName']);
mongodump.stdout.pipe(writeStream);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment