Work with ~/.mongorc.js programmatically.
var mongorc = require('mongorc');
mongorc.contents(function(err, s){
console.log('contents of current ~/.mongodb.js: ', s);
mongorc.backup(function(err){
if(err) return console.error('Backup failed: ', err);
// .. do stuff ..
// .. on nos! we had an error!
mongorc.restore(function(){
console.log('restored ~/.mongodb.js');
mongorc.contents(function(err, s){
console.log('contents of current ~/.mongodb.js: ', s);
});
});
});
});
npm install --save mongodb-js/mongorc
Apache 2