ES2015 for assert and persistence utilities

This commit is contained in:
Shaunak Kishore
2015-09-23 23:36:16 -04:00
parent cf825852e8
commit b3606087b9
3 changed files with 18 additions and 23 deletions

17
server/persistence.js Normal file
View File

@ -0,0 +1,17 @@
"use strict";
const child_process = Npm.require('child_process');
const path = Npm.require('path');
const get_backup_path = () => path.join(process.env.PWD, 'server', 'backup');
Meteor.methods({
backup() {
const path = get_backup_path();
child_process.spawn('mongodump', ['--port', '3001', '--out', path]);
},
restore() {
const path = get_backup_path();
child_process.spawn('mongorestore', ['--port', '3001', '--drop', path]);
},
});