diff --git a/TestResultSummaryService/Database.js b/TestResultSummaryService/Database.js index efb2cc6f..92aa3eb7 100644 --- a/TestResultSummaryService/Database.js +++ b/TestResultSummaryService/Database.js @@ -1,5 +1,6 @@ const { MongoClient, ObjectID } = require('mongodb'); const ArgParser = require('./ArgParser'); +const { logger } = require('./Utils'); let db; (async function () { @@ -33,6 +34,22 @@ let db; // do nothing. The collection may already exist } } + const testResultsDB = db.collection('testResults'); + + const parentIdIndex = await testResultsDB.createIndex({ parentId: 1 }); + logger.info('Index created: ', parentIdIndex); + const urlBuildNameBuildNumIndex = await testResultsDB.createIndex({ + url: 1, + buildName: 1, + buildNum: 1, + }); + logger.info('Index created: ', urlBuildNameBuildNumIndex); + + const result = await testResultsDB.listIndexes().toArray(); + logger.info('Existing testResults indexes:'); + for (const doc of result) { + logger.info(doc); + } })(); class Database {