add index on path and repoId for files

This commit is contained in:
tdurieux
2024-04-27 17:49:13 +01:00
parent 378942a28e
commit 3d3a03fd04
2 changed files with 3 additions and 1 deletions

View File

@@ -179,7 +179,7 @@ export default class Repository {
if (opt.recursive === false) {
pathQuery = opt.path ? new RegExp(`^${opt.path}$`) : "";
}
const query: FilterQuery<IFile> = {
repoId: this.repoId,
};

View File

@@ -12,6 +12,8 @@ const FileSchema = new Schema({
},
});
FileSchema.index({ path: 1, repoId: 1 });
FileSchema.methods.toString = function () {
return `${this.path}/${this.name}`;
};