1.0.0 • Published 1 year ago

@xanhz/mongo-tools v1.0.0

Weekly downloads
-
License
UNLICENSED
Repository
github
Last release
1 year ago

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));
1.0.0

1 year ago