-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.js
50 lines (43 loc) · 1.51 KB
/
config.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var express = require('express');
var MongoClient = require('mongodb').MongoClient;
var url = "mongodb://nicholas:[email protected]:61118/visualisation";
//module.exports = MongoClient;
exports.findAll = function(err, db) {
MongoClient.connect(url, function(err, db) {
if (err) throw err;
var dbo = db.db("visualisation");
var query = { name: "COLUMBUS" };
dbo.collection("conversation").find(query).toArray(function(err, result) {
if (err) throw err;
console.log(result);
res.send(err, result);
db.close();
});
});
};
/*
exports.findall = function(req, res){
MongoClient.connect("mongodb://nicholas:[email protected]:61118/visualisation", function(err, db) {
if (err) throw err;
var dbo = db.db("visualisation");
dbo.collection("conversation").find().toArray(function(err, result) {
if (err) throw err;
res.send(result);
db.close();
});
});
};
exports.findById = function(req, res) {
var id = req.params.id;
console.log('Retrieving drink: ' + id);
MongoClient.connect("mongodb://nicholas:[email protected]:61118/visualisation", function(err, db) {
if (err) throw err;
var dbo = db.db("visualisation");
db.collection('visualisation', function(err, collection) {
collection.findOne({'_id':new BSON.ObjectID(id)}, function(err, item) {
res.send(item);
});
});
});
};
*/