12345678910111213141516171819202122 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin');
- // 馆管理
- const place = {
- name: { type: String }, // 名称
- center: { type: Array }, // 中心点
- desc: { type: String }, // 简述
- config: { type: Object }, // 设置
- pic: { type: Array }, // 图片
- plan_word: { type: String }, // 保安方案
- remark: { type: String },
- };
- const schema = new Schema(place, { toJSON: { virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ name: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Place', schema, 'place');
- };
|