mongodb-auto-backup
v1.0.2
Published
package to use for getting backup of mongoDB
Downloads
69
Readme
MongoDB Backup with AWS S3
Installation
npm install mongodb-auto-backup
Configuration
var db_backup = require('mongodb-auto-backup');
db_backup.config({
db: '<Database Name>', // Required
output: '<Output to local Directory>', // Required
dir_prefix: '<Directory prefix>', // Optional
deleteLocal: true | false,
s3Upload: true | false, // Default: false, Optional
accessKeyId: '<AWS accessKeyId>',
secretAccessKey: '<AWS secretAccessKey>',
bucket: '<AWS Bucket name>',
region: '<AWS Bucket Region Name>',
debug: true | false // Default: true, Optional
});
Run Manually
db_backup.run();
Schedule
db_backup.schedule('<Schdule>');
We use node-cron to run cron jobs, This is a quick reference to cron syntax and also shows the options supported by node-cron.
Allowed fields
# ┌────────────── second (optional)
# │ ┌──────────── minute
# │ │ ┌────────── hour
# │ │ │ ┌──────── day of month
# │ │ │ │ ┌────── month
# │ │ │ │ │ ┌──── day of week
# │ │ │ │ │ │
# │ │ │ │ │ │
# * * * * * *
Allowed values
| field | value | |--------------|---------------------| | second | 0-59 | | minute | 0-59 | | hour | 0-23 | | day of month | 1-31 | | month | 1-12 (or names) | | day of week | 0-7 (or names, 0 or 7 are sunday) |