Skip to content
Snippets Groups Projects
Unverified Commit f2c71da6 authored by Ricardo Garim's avatar Ricardo Garim Committed by GitHub
Browse files

fix: remove redundant index specs in UserDataFile inherited from BaseUpload (#34185)

parent a4ef5ab8
No related branches found
No related tags found
No related merge requests found
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';
......@@ -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);
}
......
......@@ -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 },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment