18 lines
622 B
JavaScript
18 lines
622 B
JavaScript
// Initialize MongoDB database
|
|
|
|
// Switch to the application database
|
|
db = db.getSiblingDB(process.env.MONGO_INITDB_DATABASE || 'adastradb');
|
|
|
|
// Create a collection for data import history
|
|
// This collection will track all data imports for audit and recovery purposes
|
|
db.createCollection('dataImportHistory', {
|
|
capped: false
|
|
});
|
|
|
|
// Create an index on the importDate for better query performance
|
|
db.dataImportHistory.createIndex({ importDate: -1 });
|
|
db.dataImportHistory.createIndex({ status: 1 });
|
|
|
|
print(`✓ Database '${db.getName()}' initialized successfully`);
|
|
print(`✓ Collection 'dataImportHistory' created`);
|