Fix mongodump command syntax

This commit is contained in:
Aaron 2020-01-29 21:12:09 +01:00 committed by GitHub
parent 02217b5032
commit a7ceabafc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

4
db.js
View File

@ -987,7 +987,7 @@ module.exports.CreateDB = function (parent, func) {
if (parent.config.settings.autobackup && parent.config.settings.autobackup.mongodumppath) { mongoDumpPath = parent.config.settings.autobackup.mongodumppath; } if (parent.config.settings.autobackup && parent.config.settings.autobackup.mongodumppath) { mongoDumpPath = parent.config.settings.autobackup.mongodumppath; }
const child_process = require('child_process'); const child_process = require('child_process');
const cmd = '\"' + mongoDumpPath + '\" --db=\"' + dbname + '\" --archive=\"' + newBackupPath + '.archive\"'; const cmd = '\"' + mongoDumpPath + '\" --db=\"' + dbname + '\" --archive=\"' + newBackupPath + '.archive\"';
if (dburl) { cmd = '\"' + mongoDumpPath + '\" --url=\"' + dburl + '\" --db=\"' + dbname + '\" --archive=\"' + newBackupPath + '.archive\"'; } if (dburl) { cmd = '\"' + mongoDumpPath + '\" --uri=\"' + dburl + '\" --archive=\"' + newBackupPath + '.archive\"'; }
var backupProcess = child_process.exec(cmd, { cwd: backupPath }, function (error, stdout, stderr) { var backupProcess = child_process.exec(cmd, { cwd: backupPath }, function (error, stdout, stderr) {
try { try {
backupProcess = null; backupProcess = null;
@ -1125,4 +1125,4 @@ module.exports.CreateDB = function (parent, func) {
} }
return obj; return obj;
}; };