backup data for mongodb for Nodejs
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
examples
test test: add timeout before clean dirs Dec 12, 2016
.gitignore improve *ignore Feb 4, 2015
.npmignore test: add `coveralls` Feb 24, 2015
.travis.yml build: update node tested version Jan 28, 2018
CHANGELOG.md 1.6.9 Dec 13, 2016
Gruntfile.js
LICENSE Create LICENSE Mar 17, 2017
README.md
appveyor.yml build: update node tested version Jan 28, 2018
index.js deps: update bson@1.0.1 Dec 11, 2016
index.min.js
package-lock.json
package.json deps: update mongodb@2.2.31 Jan 28, 2018

README.md

mongodb-backup

NPM version Linux Status Windows Status Dependency Status Coveralls

Backup for mongodb

Look at mongodb-backup-cli for command line usage, similar to mongodump

Look at mongodb-restore for restore data

Installation

Install through NPM

npm install mongodb-backup

or

git clone git://github.com/hex7c0/mongodb-backup.git

Bson@0.4.11 has been pulled out, so versions >= 1.3.0 and <= 1.4.1 are deprecated

API

inside nodejs project

var backup = require('mongodb-backup');

backup({
  uri: 'uri', // mongodb://<dbuser>:<dbpassword>@<dbdomain>.mongolab.com:<dbport>/<dbdatabase>
  root: __dirname
});

backup(options)

options

  • uri - String URI for MongoDb connection (default "required")
  • root- String Path where save data (default "required")
  • [parser] - String | Function Data parser (bson, json) or custom (default "bson")
  • [collections] - Array Select which collections save (default "disabled")
  • [callback] - Function Callback when done (default "disabled")
  • [stream]- Object Send .tar file to Node stream (default "disabled")
  • [tar] - String Pack files into a .tar file (default "disabled")
  • [query] - Object Query that optionally limits the documents included (default "{}")
  • [numCursors] - Number Set number of cursor for parallelCollectionScan without query (default "disabled")
  • [logger] - String Path where save a .log file (default "disabled")
  • [metadata] - Boolean Save metadata of collections as Index, ecc (default "false")
  • [options] - Object MongoDb options (default)

Examples

Take a look at my examples

License Apache2