feat: Add indexes based on the usage in the code

This commit is contained in:
mrjvs
2025-09-03 21:31:35 +02:00
parent 91ec0e7d8a
commit a4a20852f6
2 changed files with 5 additions and 0 deletions

View File

@@ -33,4 +33,7 @@ FileSchema.plugin(AutoIncrementID, {
field: 'data_id'
});
FileSchema.index({ task_id: 1, boss_app_id: 1 });
FileSchema.index({ task_id: 1, boss_app_id: 1, name: 1 });
export const File = mongoose.model<IFile, FileModel>('File', FileSchema);

View File

@@ -20,4 +20,6 @@ const TaskSchema = new mongoose.Schema<ITask, TaskModel, ITaskMethods>({
updated: BigInt
}, { id: false });
TaskSchema.index({ boss_app_id: 1, id: 1 });
export const Task = mongoose.model<ITask, TaskModel>('Task', TaskSchema);