'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin'); // 信息表 const NewsSchema = { column_id: { type: String, required: false, maxLength: 500 }, // 栏目id column_name: { type: String, required: false, maxLength: 500 }, // 栏目名称 title: { type: String, required: false, maxLength: 500 }, // 标题 titlejj: { type: String, required: false, maxLength: 500 }, // 标题简介 orgin: { type: String, required: false, maxLength: 500 }, // 来源 publish: { type: String, required: false, maxLength: 500 }, // 发布者 publish_time: { type: String, required: false, maxLength: 500 }, // 发布时间 uid: { type: String, required: false, maxLength: 500 }, // 用户id content: { type: String, required: false }, // 正文 picture: { type: String, required: false }, // 图片路径 filepath: { type: String, required: false }, // 文件路径 }; const schema = new Schema(NewsSchema, { toJSON: { virtuals: true } }); schema.index({ id: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('News', schema, 'live_news'); };