-
Notifications
You must be signed in to change notification settings - Fork 1
/
controller.js
46 lines (39 loc) · 927 Bytes
/
controller.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
var mongoose = require('mongoose');
mongoose.connect(process.env.mongo_uri);
var Schema = mongoose.Schema;
var userSchema, User, guideSchema, Guide;
var db = mongoose.connection;
db.on('error', console.error.bind(console, 'connection error:'));
db.once('open', function() {
// we're connected!
console.log('Mongodb Connected');
});
userSchema = new Schema({
userId: Number,
userName: String,
loc: {
lat: Number,
lon: Number
}
});
User = mongoose.model('User', userSchema);
guideSchema = new Schema({
guideId: Number,
name: String,
phone: Number,
city: String,
});
Guide = mongoose.model('Guide', guideSchema);
activitySchema = new Schema({
guideId: Number,
name: String,
loc: String,
city: String,
dat: String
});
Activity = mongoose.model('Activity', guideSchema);
module.exports = {
User: User,
Guide: Guide,
Activity: Activity
}