1234567891011121314151617181920 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 栏目表
- const FlowerSchema = {
- name: { type: String, required: true, maxLength: 500 }, // 名称
- type: { type: String, required: false, maxLength: 500 }, // 类别
- dock_id: { type: String, required: false, maxLength: 500 }, // 展会id
- };
- const schema = new Schema(FlowerSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Flower', schema, 'flower');
- };
|