12345678910111213141516 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 测试信息
- const TestmessSchema = {
- title: { type: String, required: true, maxLength: 200 }, // 标题
- };
- const schema = new Schema(TestmessSchema, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Testmess', schema, 'testmess');
- };
|