18 lines
398 B
JavaScript
18 lines
398 B
JavaScript
|
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
|
||
|
}
|