mirror of
https://github.com/bluewave-labs/Checkmate.git
synced 2026-02-14 13:29:25 -06:00
Sync indices on startup
This commit is contained in:
@@ -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({
|
||||
|
||||
Reference in New Issue
Block a user