Skip to content

Commit

Permalink
fix: remove redundant index specs in UserDataFile inherited from Base…
Browse files Browse the repository at this point in the history
…Upload (#34185)
  • Loading branch information
ricardogarim authored Dec 16, 2024
1 parent a4ef5ab commit f2c71da
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 5 additions & 1 deletion apps/meteor/server/models/raw/Avatars.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { IAvatar, RocketChatRecordDeleted, IUser } from '@rocket.chat/core-typings';
import type { IAvatarsModel } from '@rocket.chat/model-typings';
import type { Collection, Db, FindOptions } from 'mongodb';
import type { Collection, Db, IndexDescription, FindOptions } from 'mongodb';

import { BaseUploadModelRaw } from './BaseUploadModel';

Expand All @@ -9,6 +9,10 @@ export class AvatarsRaw extends BaseUploadModelRaw implements IAvatarsModel {
super(db, 'avatars', trash);
}

protected modelIndexes(): IndexDescription[] {
return [...super.modelIndexes(), { key: { userId: 1 }, sparse: true }];
}

findOneByUserId(userId: IUser['_id'], options?: FindOptions<IAvatar>) {
return this.findOne({ userId }, options);
}
Expand Down
1 change: 0 additions & 1 deletion apps/meteor/server/models/raw/BaseUploadModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ type T = IUpload;
export abstract class BaseUploadModelRaw extends BaseRaw<T> implements IBaseUploadsModel<T> {
protected modelIndexes(): IndexDescription[] {
return [
{ key: { userId: 1 }, sparse: true },
{ key: { name: 1 }, sparse: true },
{ key: { rid: 1 }, sparse: true },
{ key: { expiresAt: 1 }, sparse: true },
Expand Down

0 comments on commit f2c71da

Please sign in to comment.