'use strict'; const mongoose = require('mongoose'); const Schema = mongoose.Schema; const LogPlayerCountSchema = new Schema({ war: { type: mongoose.Schema.Types.ObjectId, ref: 'War', required: true, }, time: { type: Date, required: true, }, countBlufor: { type: Number, get: (v) => Math.round(v), set: (v) => Math.round(v), required: true, }, countOpfor: { type: Number, get: (v) => Math.round(v), set: (v) => Math.round(v), required: true, }, }, { collection: 'logPlayerCount', versionKey: false, }); // optional more indices LogPlayerCountSchema.index({war: 1}); module.exports = mongoose.model('LogPlayerCount', LogPlayerCountSchema);