From ab7c4fc930cf1e37bdc2f77cd9adca71e3d8a9d7 Mon Sep 17 00:00:00 2001 From: antoineludeau <52679050+antoineludeau@users.noreply.github.com> Date: Tue, 30 Apr 2024 14:01:06 +0200 Subject: [PATCH] Added index for mongo on ban ids --- lib/util/mongo.cjs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/util/mongo.cjs b/lib/util/mongo.cjs index f29f97d5..83389e6d 100644 --- a/lib/util/mongo.cjs +++ b/lib/util/mongo.cjs @@ -20,10 +20,16 @@ class Mongo { async createIndexes() { await this.db.collection('voies').createIndex({codeCommune: 1}) await this.db.collection('voies').createIndex({idVoie: 1}, {unique: true}) + await this.db.collection('voies').createIndex({banId: 1}, {unique: true}) + await this.db.collection('voies').createIndex({banIdDistrict: 1}) await this.db.collection('voies').createIndex({tiles: 1}) await this.db.collection('numeros').createIndex({codeCommune: 1}) await this.db.collection('numeros').createIndex({idVoie: 1}) await this.db.collection('numeros').createIndex({id: 1}, {unique: true}) + await this.db.collection('numeros').createIndex({banId: 1}, {unique: true}) + await this.db.collection('numeros').createIndex({banIdMainCommonToponym: 1}) + await this.db.collection('numeros').createIndex({banIdSecondaryCommonToponyms: 1}) + await this.db.collection('numeros').createIndex({banIdDistrict: 1}) await this.db.collection('numeros').createIndex({tiles: 1}) await this.db.collection('pseudo_codes_voies').createIndex({codeCommune: 1}) await this.db.collection('sources_adresses').createIndex({codeCommune: 1, dataSource: 1}) @@ -32,6 +38,7 @@ class Mongo { await this.db.collection('sources_communes').createIndex({source: 1, part: 1}) await this.db.collection('communes').createIndex({compositionAskedAt: 1}, {sparse: true}) await this.db.collection('communes').createIndex({codeCommune: 1}, {unique: true}) + await this.db.collection('communes').createIndex({banId: 1}, {unique: true}) await this.db.collection('metrics').createIndex({name: 1, date: 1}, {unique: true}) }