@xanhz/mongo-tools
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

mongo-tools

A NodeJS Package for MongoDB Database Tools

1. Mongo Dump

const { MongoTools } = require('@xanhz/mongo-tools');

MongoTools.$dump({
  host: '127.0.0.1',
  db: 'test-dump',
  archive: 'test-dump.gz',
  gzip: true,
})
  .then(() => console.log('Finish'))
  .catch((error) => console.error(error));

2. Mongo Restore

const { MongoTools } = require('@xanhz/mongo-tools');

MongoTools.$restore({
  host: '127.0.0.1',
  db: 'test-dump',
  archive: 'test-dump.gz',
  gzip: true,
})
  .then(() => console.log('Finish'))
  .catch((error) => console.error(error));

3. Mongo Import

const { MongoTools } = require('@xanhz/mongo-tools');

MongoTools.$import({
  host: '127.0.0.1',
  db: 'test-dump',
  collection: 'products',
  file: 'products.json',
})
  .then(() => console.log('Finish'))
  .catch((error) => console.error(error));

3. Mongo Export

const { MongoTools } = require('@xanhz/mongo-tools');

MongoTools.$export({
  host: '127.0.0.1',
  db: 'test-dump',
  collection: 'products',
  out: 'products.json',
})
  .then(() => console.log('Finish'))
  .catch((error) => console.error(error));

Readme

Keywords

Package Sidebar

Install

npm i @xanhz/mongo-tools

Weekly Downloads

0

Version

1.0.0

License

UNLICENSED

Unpacked Size

13.5 kB

Total Files

17

Last publish

Collaborators

  • xanhz