perf: schema indexes (#3446)

This commit is contained in:
Archer
2024-12-21 00:01:14 +08:00
committed by GitHub
parent b48eff4212
commit e5b8dea9ae
3 changed files with 11 additions and 3 deletions

View File

@@ -79,8 +79,10 @@ const UserSchema = new Schema({
try {
// login
UserSchema.index({ username: 1, password: 1 });
UserSchema.index({ createTime: -1 });
UserSchema.index({ username: 1, password: 1 }, { background: true });
// Admin charts
UserSchema.index({ createTime: -1 }, { background: true });
} catch (error) {
console.log(error);
}