'use strict'; const Schema = require('mongoose').Schema; const metaPlugin = require('naf-framework-mongoose-free/lib/model/meta-plugin'); // 我的收藏 const collects = { user_id: { type: String, required: false, zh: '用户id' }, // user_name: { type: String, required: false, zh: '用户名称' }, // video_id: { type: String, required: false, zh: '视频id' }, // title: { type: String, required: false, zh: '视频名称' }, // img_url: { type: Array, required: false, zh: '图片' }, // view_num: { type: String, required: false, zh: '观看次数' }, // time_num: { type: String, required: false, zh: '时长' }, // follow_time: { type: String, required: false, zh: '关注时间' }, // }; const schema = new Schema(collects, { toJSON: { getters: true, virtuals: true } }); schema.index({ id: 1 }); schema.index({ 'meta.createdAt': 1 }); schema.index({ user_id: 1 }); schema.index({ user_name: 1 }); schema.index({ video_id: 1 }); schema.index({ title: 1 }); schema.index({ view_num: 1 }); schema.index({ time_num: 1 }); schema.index({ follow_time: 1 }); schema.plugin(metaPlugin); module.exports = app => { const { mongoose } = app; return mongoose.model('Collects', schema, 'collects'); };