diff --git a/Practical/Practical Exam/MongoDB/M4 - Aggregation.md b/Practical/Practical Exam/MongoDB/M4 - Aggregation.md index b823900..2468da4 100644 --- a/Practical/Practical Exam/MongoDB/M4 - Aggregation.md +++ b/Practical/Practical Exam/MongoDB/M4 - Aggregation.md @@ -168,14 +168,14 @@ for (let i = 1; i <= 10000; i++) { db.Employee.insertOne({ Emp_id: i, Name: `Employee ${i}`, - Designation: `${Math.floor(Math.random() * 5) + 1}` + Designation: `Work ${i*5}` }); } -// Wait for it to insert 10000 documents +// Wait for it to insert 10000 documents! // Time without index let startTime = new Date(); -db.Employee.find({ Emp_id: 7500 }).toArray(); +db.Employee.find({ Emp_id: 7500 }) let endTime = new Date(); print("Time taken to search without index: " + (endTime - startTime) + " ms"); @@ -184,7 +184,7 @@ db.Employee.createIndex( { Emp_id: 1 }); // Time with index startTime = new Date(); -db.Employee.find({ Emp_id: 7500 }).toArray(); +db.Employee.find({ Emp_id: 7500 }) endTime = new Date(); print("Time taken to search with index: " + (endTime - startTime) + " ms");