1234567891011121314151617 |
- import mongoose from "mongoose";
- const PointHistorySchema = new mongoose.Schema(
- {
- user: { type: mongoose.Schema.Types.ObjectId, ref: "User", required: true },
- points: { type: Number, required: true },
- reason: { type: String, required: true },
- match: { type: mongoose.Schema.Types.ObjectId, ref: "Match" },
- },
- { timestamps: true }
- );
- PointHistorySchema.index({ "user": 1 }); // user 索引
- PointHistorySchema.index({ "match": 1 }); // match 索引
- export default mongoose.models.PointHistory ||
- mongoose.model("PointHistory", PointHistorySchema);
|