-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdb-setup.js
43 lines (28 loc) · 976 Bytes
/
db-setup.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
var mongo = require('mongodb').MongoClient;
var dbConnectionUrl = 'mongodb://heroku_kfs36l9m:[email protected]:47305/heroku_kfs36l9m';
var collections = {};
mongo.connect(dbConnectionUrl, function (err, db) {
if (err) {
console.log('Can not connect to MongoDB. Did you run it?');
console.log(err.message);
return;
}
collections.users = db.collection('users');
collections.matches = db.collection('matches');
collections.groups = db.collection("groups");
collections.profpics = db.collection("profpics")
});
module.exports = collections;
/*var mongoose = require('mongoose');
mongoose.connect('mongodb://localhost/userdb', function(err) {
if(err) {
console.log('connection error', err);
} else {
console.log('connection successful');
}
});
var UserSchema = new mongoose.Schema({
username: String,
password: String
});
module.exports = mongoose.model('User', UserSchema);*/