@tmlmobilidade/go-interfaces-rawdb 20260723.2334.13 → 20260724.946.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -173,12 +173,8 @@ export class MongoInterfaceTemplate {
|
|
|
173
173
|
*/
|
|
174
174
|
async syncIndexes() {
|
|
175
175
|
try {
|
|
176
|
-
if (this.indexDescription === false)
|
|
177
|
-
Logger.info({ message: `MONGODB [${this.collectionName}]: Skipping index synchronization.` });
|
|
176
|
+
if (this.indexDescription === false)
|
|
178
177
|
return;
|
|
179
|
-
}
|
|
180
|
-
// Start index synchronization process
|
|
181
|
-
Logger.info({ message: `MONGODB [${this.collectionName}]: Synchronizing indexes...` });
|
|
182
178
|
// Normalize already applied and new indexes
|
|
183
179
|
// and filter the default _id index.
|
|
184
180
|
const existingIndexes = await this.collection.indexes();
|
|
@@ -194,13 +190,12 @@ export class MongoInterfaceTemplate {
|
|
|
194
190
|
if (!found)
|
|
195
191
|
indexesToCreate.push(desiredIdx);
|
|
196
192
|
}
|
|
197
|
-
// Create indexes
|
|
193
|
+
// Create indexes (log only when something is actually added)
|
|
198
194
|
for (const idx of indexesToCreate) {
|
|
199
195
|
Logger.info({ message: `MONGODB [${this.collectionName}]: Creating index on keys ${JSON.stringify(idx.key)} with options ${JSON.stringify(prepareMongoIndexOptions(idx))}.` });
|
|
200
196
|
await this.collection.createIndex(idx.key, prepareMongoIndexOptions(idx));
|
|
201
197
|
Logger.success(`MONGODB [${this.collectionName}]: Created index on keys ${JSON.stringify(idx.key)}.`);
|
|
202
198
|
}
|
|
203
|
-
Logger.success(`MONGODB [${this.collectionName}]: Indexes synchronized.`);
|
|
204
199
|
}
|
|
205
200
|
catch (error) {
|
|
206
201
|
Logger.error({ error, message: `MONGODB [${this.collectionName}]: Error @ syncIndexes(): ${error.message}` });
|