0
0
MongoDBquery~10 mins

Profiler for slow queries in MongoDB - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to enable the profiler for slow queries in MongoDB.

MongoDB
db.setProfilingLevel([1])
Drag options to blanks, or click blank then click option'
A2
B0
C3
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Using level 0 disables profiling.
Level 3 is not a valid profiling level.
2fill in blank
medium

Complete the code to set the slow operation threshold to 100 milliseconds.

MongoDB
db.setProfilingLevel(1, { slowms: [1] })
Drag options to blanks, or click blank then click option'
A100
B10
C1000
D10000
Attempts:
3 left
💡 Hint
Common Mistakes
Setting slowms too high misses slow queries.
Setting slowms too low may log too many queries.
3fill in blank
hard

Fix the error in the command to retrieve slow queries from the system profiler collection.

MongoDB
db.system.profile.find({ [1]: { $gt: 100 } })
Drag options to blanks, or click blank then click option'
AexecutionTime
BtimeMillis
Cmillis
DdurationMillis
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect field names like 'durationMillis' or 'timeMillis'.
Using 'executionTime' which is not a valid field.
4fill in blank
hard

Fill both blanks to query slow operations longer than 200 ms and sort by duration descending.

MongoDB
db.system.profile.find({ [1]: { $gt: 200 } }).sort({ [2]: -1 })
Drag options to blanks, or click blank then click option'
AdurationMillis
Bmillis
DexecutionTime
Attempts:
3 left
💡 Hint
Common Mistakes
Using different field names for filter and sort.
Sorting ascending instead of descending.
5fill in blank
hard

Fill all three blanks to enable profiling for slow queries over 150 ms and retrieve them sorted by duration.

MongoDB
db.setProfilingLevel([1], { slowms: [2] }); db.system.profile.find({ [3]: { $gt: 150 } }).sort({ [3]: -1 })
Drag options to blanks, or click blank then click option'
A1
B150
Cmillis
D2
Attempts:
3 left
💡 Hint
Common Mistakes
Using profiling level 2 which profiles all queries.
Using inconsistent field names for filtering and sorting.