forked from sisoc-tokyo/pubkey-auth-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodel.js
23 lines (19 loc) · 744 Bytes
/
model.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
var mongoose = require('mongoose');
var db = mongoose.connect('mongodb://localhost/bbs');
var rsa = mongoose.createConnection('mongodb://localhost/pubkagi');
function validator(v) {
return v.length > 0;
}
var PostBbs = new mongoose.Schema({
text : { type: String, validate: [validator, "Empty Error"] }
, name : { type: String, required: true }
, created: { type: Date, default: Date.now }
});
var PostPubkagi = new mongoose.Schema({
name : { type: String, required: true }
, pass : { type: String, required: true }
, pubkey : { type: String, required: true }
, created: { type: Date, default: Date.now }
})
exports.PostBbs = db.model('Post', PostBbs)
exports.PostPubkagi = rsa.model('PostPubkagi', PostPubkagi)