From dcb8cbbe4dea8f98d34f62cb005b2989f5acff58 Mon Sep 17 00:00:00 2001 From: Nicolas Dupont Date: Tue, 19 Dec 2023 11:04:00 +0100 Subject: [PATCH] Add index to improve query performance --- src/archivist/recorder/repositories/mongo/index.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/archivist/recorder/repositories/mongo/index.js b/src/archivist/recorder/repositories/mongo/index.js index e135acc20..08b8efaf4 100644 --- a/src/archivist/recorder/repositories/mongo/index.js +++ b/src/archivist/recorder/repositories/mongo/index.js @@ -24,6 +24,8 @@ export default class MongoRepository extends RepositoryInterface { this.collection = db.collection(this.collectionName); + await this.collection.createIndex({ serviceId: 1, termsType: 1, fetchDate: -1 }); + return this; }