opt-cc/server/models/logs/player-count.js

35 lines
692 B
JavaScript

'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',
});
// optional more indices
LogPlayerCountSchema.index({war: 1});
module.exports = mongoose.model('LogPlayerCount', LogPlayerCountSchema);