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

36 lines
713 B
JavaScript
Raw Permalink Normal View History

2019-02-09 11:54:16 +01:00
'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,
2019-02-09 11:54:16 +01:00
});
// optional more indices
LogPlayerCountSchema.index({war: 1});
module.exports = mongoose.model('LogPlayerCount', LogPlayerCountSchema);