0.2.5 • Published 9 years ago

mongodb-io v0.2.5

Weekly downloads
6
License
MIT
Repository
github
Last release
9 years ago

NPM version Downloads

mongodb-io

export & import mongodb documents, base on mongodump and mongorestore.

Support

only for linux x64 and OS X x64.

Usage

import DBIO from 'mongodb-io';

config

The second argument in DBIO.export or DBIO.import, params and default value seems like:

{
  host: 127.0.0.1,
  port: 27017,
  user,
  password,
  out: 'dump', // export filename
  drop: false, // Before restoring the collections from the dumped backup, drops the collections from the target database.
  filePath: '' // path to read `tar.gz` file for mongorestore.
}

export

var filePath = await DBIO.export({config, dbs}); // this is a `tar.gz` file

if dbs is not a array, will export all dbs. dbs is seems like:

['dbName1', {name: 'dbName2', collections}, ...]

the array of database names, or database settings you want to export.

collections is seems like:

['collectionName1', {name: 'collectionName2', query: '{_id: 111}'}, ...]

the array of collection names, or collection settings you want to export.

import

await DBIO.import({config, dbs});

In each item of dbs or collections you could set drop, like that item in config.

errors

Error: {name: 'DBIO_XXX_ERR', message: 'where error happend'}
0.2.5

9 years ago

0.2.4

9 years ago

0.2.3

9 years ago

0.2.2

9 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.9

10 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago

0.0.0

10 years ago