Sync indices on startup

This commit is contained in:
Alex Holliday
2024-12-28 09:35:34 -08:00
parent ce3e7cf384
commit bdf23a45b7

View File

@@ -91,6 +91,13 @@ class MongoDB {
appSettings = new AppSettings({});
await appSettings.save();
}
// Sync indexes
const models = mongoose.modelNames();
for (const modelName of models) {
const model = mongoose.model(modelName);
await model.syncIndexes();
}
logger.info({ message: "Connected to MongoDB" });
} catch (error) {
logger.error({