Skip to content

Commit

Permalink
Merge pull request #397 from BaseAdresseNationale/antoineludeau/add-b…
Browse files Browse the repository at this point in the history
…an-id-index

Added index for mongo on ban ids
  • Loading branch information
antoineludeau authored Apr 30, 2024
2 parents abb2fc4 + ab7c4fc commit 6a386c1
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/util/mongo.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -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})
Expand All @@ -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})
}

Expand Down

0 comments on commit 6a386c1

Please sign in to comment.