lora-project/server-api/libs/mongo_model.js

18 lines
398 B
JavaScript
Raw Normal View History

2017-06-02 14:53:34 +00:00
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
}