1234567891011121314151617181920 |
- 'use strict';
- const Schema = require('mongoose').Schema;
- const metaPlugin = require('naf-framework-mongoose/lib/model/meta-plugin');
- // 积分归档
- const DocumentSchema = {
- create_time: { type: String, required: false, zh: '归档时间' }, //
- record: { type: Array, required: false, zh: '记录' }, //
- };
- const schema = new Schema(DocumentSchema, { toJSON: { getters: true, virtuals: true } });
- schema.index({ id: 1 });
- schema.index({ 'meta.createdAt': 1 });
- schema.index({ create_time: 1 });
- schema.plugin(metaPlugin);
- module.exports = app => {
- const { mongoose } = app;
- return mongoose.model('Document', schema, 'document');
- };
|