'use strict'; const Schema = require('mongoose').Schema; const moment = require('moment'); const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin'); const { ObjectId } = require('mongoose').Types; // 工牌账号缓存 const cardAdmin = { uid: { type: String }, // 工牌账号id uKey: { type: String }, // 工牌账号授权码 remark: { type: String }, }; const schema = new Schema(cardAdmin, { toJSON: { virtuals: true } }); schema.index({ 'meta.createdAt': 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('CardAdmin', schema, 'card_admin'); };