12345678910111213141516171819 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 宣传视频表
- const videoSchema = {
- name: { type: String, required: true, maxLength: 200 }, // 名称
- videopath: { type: String, required: false, maxLength: 200 }, // 视频
- create_time: { type: String, required: false, maxLength: 200 }, // 发布时间
- };
- const schema = new Schema(videoSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Video', schema, 'video');
- };
|