12345678910111213141516171819 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 栏目表
- const ColumnSchema = {
- name: { type: String, required: true, maxLength: 500 }, // 栏目名称
- site: { type: String, required: false, maxLength: 500 }, // 栏目位置
- };
- const schema = new Schema(ColumnSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Column', schema, 'serve_column');
- };
|