-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.js
More file actions
30 lines (28 loc) · 764 Bytes
/
Copy pathserver.js
File metadata and controls
30 lines (28 loc) · 764 Bytes
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
// // Retrieve
// var MongoClient = require('mongodb').MongoClient;
//
// // Connection
// var url = 'mongodb://localhost:3001/cap-dev';
//
// // Connect
// MongoClient.connect(url, function (err, db) {
// if (err) {
// console.log('Unable to connect to the mongoDB server. Error:', err);
// } else {
// // connected
// console.log('Connection established to', url);
//
// // do some work here with the database.
//
// // close connection
// db.close();
// }
// });
var MongoClient = require('mongodb').MongoClient;
var assert = require('assert');
var url = 'mongodb://localhost/boozeybites';
MongoClient.connect(url, function(err, db) {
assert.equal(null, err);
console.log("Connected correctly to server.");
db.close();
});