@xanhz/mongo-tools
v1.0.0
Published
A NodeJS package for Mongo Tools
Downloads
4
Readme
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));