-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmodel.js
More file actions
33 lines (29 loc) · 789 Bytes
/
model.js
File metadata and controls
33 lines (29 loc) · 789 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
31
32
33
var mongoose = require('mongoose'),
schema = mongoose.Schema,
objectId = schema.ObjectId;
var User = new schema({
id: objectId,
firstName : String,
lastName : String,
email: { type: String, unqiue: true },
google: { type: String, unqiue: true },
twitter: { type: String, unique: true },
facebook: { type: String, unique: true }
});
var Dibb = new schema({
id : objectId,
name : String,
email: String,
name : { type: String, unique: true },
description : String,
date : { type: Date, default: Date.now },
endDate : Date,
active : Boolean,
tags : [String]
});
exports.getUserModel = function(){
return mongoose.model('user', User);
}
exports.getDibbModel = function(){
return mongoose.model('dibb', Dibb);
}