12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- 'use strict';
- module.exports = app => {
- const mongoose = app.mongoose;
- const Schema = mongoose.Schema;
- const FamilySchema = new Schema({
- dept1: {
- type: Schema.Types.ObjectId,
- ref: 'sysDept',
- },
- dept2: {
- type: Schema.Types.ObjectId,
- ref: 'sysDept',
- },
- dept3: {
- type: Schema.Types.ObjectId,
- ref: 'sysDept',
- },
- dept4: {
- type: Schema.Types.ObjectId,
- ref: 'sysDept',
- },
- dept5: {
- type: Schema.Types.ObjectId,
- ref: 'sysDept',
- },
- userid: {
- type: Schema.Types.ObjectId,
- ref: 'sysUser',
- },
- // userName: { type: String }, // 采集员
- time: { type: Date, default: Date.now },
- openId: { type: Array }, // 赡养人微信openid
- // appletId: { type: Array }, // 赡养人小程序openid
- });
- FamilySchema.index({ userid: 1 }, { background: true, name: 'family_userid_1' });
- FamilySchema.index({ time: 1 }, { background: true, name: 'family_time_1' });
- FamilySchema.index({ openId: 1 }, { background: true, name: 'family_openId_1' });
- return mongoose.model('Family', FamilySchema, 'family');
- };
|