This commit is contained in:
Belen Curcio
2016-11-04 12:47:56 -03:00
parent 024e902fbe
commit 0cc5bdb04f
2 changed files with 11 additions and 5 deletions
+1 -1
View File
@@ -35,7 +35,7 @@
"no-throw-literal": [2],
"yoda": [1],
"no-path-concat": [2],
"no-process-exit": [0],
"no-process-exit": [2],
"eol-last": [1],
"no-continue": [1],
"no-nested-ternary": [1],
+10 -4
View File
@@ -1,7 +1,13 @@
const Setting = require('../models/setting');
const defaults = {id: '1', moderation: 'pre'};
Setting.update({id: '1'}, {$setOnInsert: defaults}, {upsert: true}).then(() => {
console.log('created settings object.');
process.exit();
}).catch(console.error);
try {
Setting.update({id: '1'}, {$setOnInsert: defaults}, {upsert: true})
.then(() => {
console.log('Created settings object.');
}).catch((err) => {
if (err) throw err;
});
} catch (err) {
console.log('Cannot create settings object.');
}