An employees collection contains documents with fields such as _id, name, age, department, and salary.
A database administrator needs to run a query that will return ONLY the name and age fields for all employees.
Which query meets this requirement?
Answer : C
The first argument to find() is the query filter and the second argument is the projection. Because the requirement applies to every employee, the filter must be an empty document {}. The projection must include name and age while explicitly suppressing _id. MongoDB includes _id by default even in inclusion projections, so { name: 1, age: 1 } would return three fields: _id, name, and age. Adding _id: 0 is the documented exception that allows _id to be excluded from an otherwise inclusion-style projection. Option C therefore produces exactly the requested fields. Options A and B mistakenly place projection-like expressions in the filter position, which would cause MongoDB to search for documents where those fields literally match the specified values rather than controlling returned fields. Option D is close but violates the word ''ONLY'' because _id remains present. Projection design can also reduce network traffic and, when a suitable index covers both the predicate and projected fields, can contribute to covered-query plans. For this requirement, however, the essential syntax is find({}, {name:1, age:1, _id:0}), so C is correct.
Study Guide reference/topic:MongoDB Architecture and Core Operations - find(), filters, projections, inclusion fields, and _id exclusion.
===========
What mongosh command connects to node-1.cluster1.mycompany.local on port 27017?
Answer : D
mongosh accepts a MongoDB host address in hostname:port form, so mongosh 'node-1.cluster1.mycompany.local:27017' is the valid choice among the commands shown. A canonical URI form such as mongosh 'mongodb://node-1.cluster1.mycompany.local:27017' is also valid, and the connection can alternatively be expressed using --host together with --port. Option A uses an unsupported --hostname switch rather than the documented --host option. Option B invents a --connect flag that is not the standard mongosh interface. Option C constructs an invalid string using an ampersand-style parameter rather than a MongoDB URI or a normal host:port target. Port 27017 is MongoDB's default server port, so it could often be omitted if the deployment uses the default, but explicitly including it is valid and removes ambiguity. In authenticated or TLS-enabled environments, the DBA would also supply credentials, authentication database, certificate settings, or a connection string carrying those parameters. For the simple host-and-port requirement in the question, option D is correct.
Study Guide reference/topic:Security, Networking, and Encryption - mongosh connectivity, host/port addressing, and connection options.
===========
What command is used to check the value that "logLevel" is set to?
Answer : D
logLevel is a MongoDB server parameter, and server parameters are retrieved through the administrative getParameter database command. The documented and unambiguous mongosh form is db.adminCommand({ getParameter: 1, logLevel: 1 }), which executes the command against the admin database and requests the current value of logLevel. The first numeric value activates the command, while the logLevel field identifies the parameter to return. Options B and C refer to a db.getParameter() helper that is not the documented interface. Option A uses db.runCommand() without explicitly switching to the admin database. Because getParameter is an administrative command, db.adminCommand() is the correct and reliable form among the choices. Administrators use server parameters to inspect and, where supported, tune aspects of mongod or mongos behavior. logLevel controls global diagnostic verbosity, while component-specific verbosity can be managed through the logging configuration. For this question, option D precisely matches the expected administrative syntax. Checking the current value before changing logging settings is also a sound operational practice during troubleshooting.
Study Guide reference/topic:Performance Monitoring and Tuning - runtime server parameters, logging configuration, and getParameter.
===========
What command should a MongoDB database administrator use to find the disk utilization of the order collection?
Answer : B
db.collection.stats() returns statistics for a specific collection, including storage-related values that help a DBA understand that collection's disk footprint. Therefore, for a collection named order, db.order.stats() is the relevant command among the choices. The result can include metrics such as logical data size, allocated storage size, document count, index information, and related collection statistics depending on version and storage engine. Option A, db.stats(), reports database-level statistics aggregated across the database rather than isolating the order collection. db.hostInfo(), option C, reports host and operating-system information rather than collection storage consumption. db.serverStatus(), option D, provides broad server-process runtime metrics such as connections, memory, operation counters, replication/storage-engine information, and other health data, but it is not the collection-specific disk-utilization interface requested here. Administrators can also use dedicated helpers such as collection storage-size or total-size methods when they need a more narrowly defined measurement. For a general collection-level statistics query targeting order, however, db.order.stats() is the correct answer, making option B correct.
Study Guide reference/topic:Performance Monitoring and Tuning - collection statistics, storage utilization, db.collection.stats(), and database/server metrics.
===========
A database administrator notices that operations on the qa database are not completing, and have been in progress for longer than expected.
What command can the administrator run to see information on in-progress operations on the qa database?
Answer : C
db.currentOp() reports information about operations that are currently in progress and accepts a filter document to restrict the output. The ns field in current-operation information identifies the namespace, typically in database.collection form. The regular expression /^qa\./ therefore matches namespaces beginning with qa., which isolates operations targeting collections in the qa database. Option C correctly supplies that namespace expression as a filter argument to db.currentOp(). Options A and B use a nonexistent db.listOps interface. Option D incorrectly treats ns as though it were a property or method chained from db.currentOp; filtering belongs inside the argument document. On current MongoDB versions, administrators are encouraged to use the $currentOp aggregation stage for more powerful filtering and composition, but the legacy helper remains the interface being tested here. Once the problematic operation is identified, the DBA can inspect details such as operation type, namespace, duration, waiting state, and client information before deciding whether additional action such as optimization or termination is justified. Thus C is the correct command.
Study Guide reference/topic:Performance Monitoring and Tuning - active operations, namespaces, long-running operation diagnostics, and currentOp.
===========
What does the totalCreated field mean in the output of the db.serverStatus().connections command?
> db.serverStatus().connections
{
"current" : 4,
"available" : 51196,
"totalCreated" : 5,
"active" : 2,
"threaded" : 4,
"exhaustIsMaster" : 1,
"exhaustHello" : 0,
"awaitingTopologyChanges" : 1
}
Answer : D
connections.totalCreated is a cumulative count of incoming connections created during the lifetime of the running MongoDB server process. It includes connections that are still open as well as connections that have already closed. That is why the example can show totalCreated: 5 while current: 4: five connections have been created since the process started, but only four remain current. Option A is incorrect because the counter is not limited to closed connections. Option C corresponds more closely to connections.current, which reports presently existing incoming client connections. Option B is imprecise because ''since the server was set up'' could imply the lifetime of the installation or deployment across restarts, whereas server-status counters generally reflect the current process lifetime. Tracking totalCreated alongside current, active, and connection-pool behavior helps administrators identify excessive connection churn, poorly configured client pools, or bursts of new connections. The most accurate interpretation among the choices is therefore the number of connections created since the server process was started, making D correct.
Study Guide reference/topic:Performance Monitoring and Tuning - serverStatus, connection metrics, and cumulative connection counters.
===========
What is the purpose of enabling TLS?
Answer : D
Transport Layer Security protects MongoDB network communications while data travels between clients and servers and, when configured, between MongoDB deployment members. Its core purpose is therefore encryption of data in transit. TLS helps prevent passive interception and tampering and also supports certificate-based identity validation. It is separate from encryption at rest, which protects files on storage media, and separate from Queryable Encryption or client-side field encryption, which protects selected application data before it reaches the server. Option A is unrelated: backup and restore operations use snapshot, managed backup, or database-tool mechanisms. Option B describes the objective of replication, elections, and redundant deployment architecture, not TLS. Option C is also incorrect; TLS is a security control, not a query-optimization mechanism, and cryptographic processing can add some overhead rather than improving query execution. A secure MongoDB deployment normally combines TLS with strong authentication, least-privilege authorization, appropriate network exposure controls, auditing, and storage or field-level encryption as required. For the specific question, enabling TLS provides encryption for data moving across the network, making option D correct.
Study Guide reference/topic:Security, Networking, and Encryption - TLS/SSL, transport encryption, certificates, and network security.
===========