'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 热点资讯表 const linksSchema = { name: { type: String, required: true, maxLength: 200 }, // 名称 linkurl: { type: String, required: true, maxLength: 800 }, // 链接地址 create_time: { type: String, required: true, maxLength: 200 }, // 发布时间 }; const schema = new Schema(linksSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Links', schema, 'links'); };