Spaces:
Running
Running
| const { ObjectId } = require("bson"); | |
| const { default: mongoose } = require("mongoose"); | |
| const Schema = mongoose.Schema; | |
| const userSchema = new Schema({ | |
| TeamID: { | |
| type: Schema.Types.ObjectId, | |
| ref: "Team" | |
| }, | |
| TeamName: { | |
| type: String, | |
| required: true | |
| }, | |
| Points: { | |
| type: Number, | |
| default: 0, | |
| required: true | |
| }, | |
| Time: { | |
| type: Date, | |
| default: Date.now() | |
| }, | |
| RoomID: { | |
| type: Schema.Types.ObjectId, | |
| ref: "Room" | |
| }, | |
| Round: { | |
| type: Number, | |
| default: 0, | |
| }, | |
| Questions: { | |
| Solved: [{ | |
| type: Schema.Types.ObjectId, | |
| ref: "Question" | |
| }], | |
| Unsolved: [{ | |
| type: Schema.Types.ObjectId, | |
| ref: "Question" | |
| }] | |
| }, | |
| Enabled: { | |
| type: Boolean, | |
| default: true, | |
| }, | |
| }); | |
| module.exports = mongoose.model("Leaderboard", userSchema); |