-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathseedDB.js
31 lines (26 loc) · 945 Bytes
/
seedDB.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
var mongoose = require('mongoose');
var spawn = require('child_process').spawn;
var DATABASE_URI = "mongodb://localhost/unityportal";
/* Connect to the DB */
mongoose.connect(DATABASE_URI,function(){
mongoose.connection.once('open', function() {
/* Drop the DB */
mongoose.connection.db.dropDatabase(function (err) {
console.log('db dropped');
/*
var args = ['--db', 'unityportal', './dump/unityportal']
var mongorestore = spawn('/usr/local/bin/mongorestore', args);
mongorestore.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
mongorestore.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
mongorestore.on('exit', function (code) {
console.log('mongorestore exited with code ' + code);
});
*/
//process.exit(0);
})
});
});