restore data from mongodb-backup 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: check callback `err` Sep 10, 2016
test test: fix new Bson API Dec 11, 2016
.gitignore improve *ignore Feb 9, 2015
.npmignore test: add coverage Mar 1, 2015
.travis.yml build: remove osx test May 29, 2017
CHANGELOG.md 1.6.2 Dec 13, 2016
Gruntfile.js build: update Gruntfile Sep 18, 2016
LICENSE Create LICENSE Mar 17, 2017
README.md build: remove osx test May 29, 2017
appveyor.yml build: remove support for node@<4 Nov 20, 2016
index.js deps: update bson@1.0.1 Dec 11, 2016
index.min.js deps: update mocha@~3.4 May 20, 2017
package.json deps: update mocha@~3.4 May 20, 2017

README.md

mongodb-restore

NPM version Linux Status Windows Status Dependency Status Coveralls

Restore data from mongodb-backup

Look at mongodb-restore-cli for command line usage, similar to mongorestore

Installation

Install through NPM

npm install mongodb-restore

or

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

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

API

inside nodejs project

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

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

restore(options)

options

  • uri - String URI for MongoDb connection (default "required")
  • root- String Path where get the backup (default "required")
  • [parser] - String | Function Data parser (bson, json) or custom (default "bson")
  • [callback] - Function Callback when done (default "disabled")
  • [stream]- Object Get .tar file from Node stream (default "disabled")
  • [tar] - String Extract files from a .tar file (default "disabled")
  • [logger] - String Path where save a .log file (default "disabled")
  • [metadata] - Boolean Set metadata of collections as Index, ecc (default "false")
  • [drop] - Boolean Drop every collection from the target database before restoring the collection (default "false")
  • [dropCollections] - Boolean|Array Drop every collection from the target database before restoring if Boolean (similar to drop option), or selected collections if Array (default "false")
  • [options] - Object MongoDb options (default)

Examples

Take a look at my examples

License Apache2