From 3d3a03fd0434dbba3d7ba93f5796f7ded6f470bd Mon Sep 17 00:00:00 2001 From: tdurieux Date: Sat, 27 Apr 2024 17:49:13 +0100 Subject: [PATCH] add index on path and repoId for files --- src/core/Repository.ts | 2 +- src/core/model/files/files.schema.ts | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/core/Repository.ts b/src/core/Repository.ts index 1e8d508..d37ce1b 100644 --- a/src/core/Repository.ts +++ b/src/core/Repository.ts @@ -179,7 +179,7 @@ export default class Repository { if (opt.recursive === false) { pathQuery = opt.path ? new RegExp(`^${opt.path}$`) : ""; } - + const query: FilterQuery = { repoId: this.repoId, }; diff --git a/src/core/model/files/files.schema.ts b/src/core/model/files/files.schema.ts index acca6f3..a9f630c 100644 --- a/src/core/model/files/files.schema.ts +++ b/src/core/model/files/files.schema.ts @@ -12,6 +12,8 @@ const FileSchema = new Schema({ }, }); +FileSchema.index({ path: 1, repoId: 1 }); + FileSchema.methods.toString = function () { return `${this.path}/${this.name}`; };