✨ feat(db): role索引修改,去掉无索引的sort
This commit is contained in:
@@ -105,13 +105,15 @@ export class Teraph {
|
||||
/**
|
||||
* 角色字段接口
|
||||
*/
|
||||
@index({ roleId: 1, serverId: 1 })
|
||||
@index({ roleId: 1 })
|
||||
@index({ roleName: 1 })
|
||||
@index({ towerLv: -1, towerUpTime: 1 })
|
||||
@index({ topLineupCe: 1, updatedAt: 1 })
|
||||
@index({ ce: -1 })
|
||||
@index({ 'userInfo.uid': 1, serverId: 1 })
|
||||
@index({ loginTime: 1 })
|
||||
@index({ serverId: 1, loginTime: 1 })
|
||||
@index({ lv: 1, loginTime: 1 })
|
||||
@index({ createdAt: 1 })
|
||||
|
||||
export default class Role extends BaseModel {
|
||||
@@ -667,7 +669,7 @@ export default class Role extends BaseModel {
|
||||
public static async getRecommedList(minLv: number, maxLv: number, time: number) {
|
||||
const result: RoleType[] = await RoleROModel.find({ loginTime: { $gt: time }, lv: { $gte: minLv, $lte: maxLv }, hasInit: true }, { _id: 0 })
|
||||
.select(ROLE_SELECT.SHOW_FRIEND_APPLY_LIST)
|
||||
.sort({ quitTime: -1, lv: -1, ce: -1 })
|
||||
.sort({ lv: -1, ce: -1 })
|
||||
.limit(200).lean({ getters: true, virtuals: true });
|
||||
return result;
|
||||
}
|
||||
@@ -681,7 +683,7 @@ export default class Role extends BaseModel {
|
||||
]
|
||||
}, { _id: 0 })
|
||||
.select(ROLE_SELECT.SHOW_FRIEND_APPLY_LIST)
|
||||
.sort({ quitTime: -1, lv: -1, ce: -1 })
|
||||
.sort({ lv: -1, ce: -1 })
|
||||
.limit(200).lean({ getters: true, virtuals: true });
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user