This set of MongoDB Multiple Choice Questions & Answers (MCQs) focuses on “Optimization Strategies – 1”.
1. Which of the following setting defines what constitutes a “slow” operation?
a) slowOpThresholdGs
b) fastOpThresholdMs
c) slowOpThresholdMs
d) none of the mentioned
View Answer
Explanation: The operationProfiling.slowOpThresholdMs setting is available only for mongod.
2. Point out the correct statement.
a) MongoDB uses a locking system to ensure data set consistency
b) If certain operations are long-running or a queue forms, performance will degrade as requests and operations wait for the lock
c) Long queries can result from ineffective use of indexes
d) All of the mentioned
View Answer
Explanation: Lock-related slowdowns can be intermittent.
3. ________ provide the number of times the lock acquisitions encountered deadlocks.
a) locks.deadlock
b) lock.deadlockCount
c) locks.deadlockCount
d) all of the mentioned
View Answer
Explanation: The globalLock data structure contains information regarding the database’s current lock state, historical lock status, current operation queue, and the number of active clients.
4. If __________ is high relative to uptime, the database has existed in a lock state for a significant amount of time.
a) globalLock.halfTime
b) globalLock.totalTime
c) globalLock.downTime
d) all of the mentioned
View Answer
Explanation: The value of totalTime represents the time, in microseconds, since the database last started and creation of the globalLock.
5. Point out the wrong statement.
a) The storage.wiredTiger.indexConfig.prefixCompression setting does not affect all indexes created
b) Database profiling can impact database performance
c) The default storage.wiredTiger.engineConfig.cacheSizeGB setting assumes that there is a single mongod instance per node
d) None of the mentioned
View Answer
Explanation: If you change the value of storage.wiredTiger.indexConfig.prefixCompression on an existing MongoDB deployment, all new indexes will use prefix compression.
6. The __________ data structure value provides more granular information concerning the number of operations queued because of a lock.
a) currentQueue
b) curQueue
c) currentQu
d) none of the mentioned
View Answer
Explanation: The serverStatus command returns a document that provides an overview of the database process’s state
7. serverStatus includes all fields by default, except _________
a) rangeDeleter
b) rangeDelete
c) rangeDEL
d) none of the mentioned
View Answer
Explanation: You may only dynamically include top-level fields from the serverStatus document that are not included by default.
8. ______ field contains total number of current clients that connect to the database instance.
a) available
b) current
c) always avail
d) none of the mentioned
View Answer
Explanation: available contains the total number of unused connections available for new clients.
9. MongoDB’s _______ is a database profiling system that can help identify inefficient queries and operations.
a) Reporter
b) Executer
c) Profiler
d) None of the mentioned
View Answer
Explanation: Enable the profiler by setting the profile value using the following command in the mongo shell.
Sanfoundry Global Education & Learning Series – MongoDB.
Here’s the list of Best Books in MongoDB.
- Apply for Programming Internship
- Check MongoDB Books
- Practice Programming MCQs
- Check Information Technology Books