add mongodb access lib
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
const mongoose = require('mongoose');
|
||||
|
||||
const tokenSchema = mongoose.Schema({
|
||||
object: Object,
|
||||
expire: {
|
||||
type: Number,
|
||||
default: Date.now
|
||||
}
|
||||
});
|
||||
// tokenSchema.method.clearExpire = function(cb) {
|
||||
// return this.model('token').remove({ expire: { $lte: Date.now() } }, cb);
|
||||
// }
|
||||
|
||||
const token = mongoose.model('token', tokenSchema, 'token');
|
||||
|
||||
module.exports = {
|
||||
token
|
||||
}
|
||||
Reference in New Issue
Block a user