forked from mysensors/MySensors
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDropDb.js
More file actions
17 lines (16 loc) · 656 Bytes
/
DropDb.js
File metadata and controls
17 lines (16 loc) · 656 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
const dbAddress = '127.0.0.1';
const dbPort = 27017;
const dbName = 'MySensorsDb';
var dbc = require('mongodb').MongoClient;
dbc.connect('mongodb://' + dbAddress + ':' + dbPort + '/' + dbName, function(err, db) {
if (err) {
console.log('Error connecting to database at mongodb://' + dbAddress + ':' + dbPort + '/' + dbName);
} else {
db.dropDatabase(function(err, result) {
if (err)
console.log('Error dropping database at mongodb://' + dbAddress + ':' + dbPort + '/' + dbName);
else
console.log('Successfully dropped database at mongodb://' + dbAddress + ':' + dbPort + '/' + dbName);
});
}
});