C100DBA MongoDB Associate Database Administrator(Based on MongoDB 6.0 and 7.0+) Questions and Answers
Which of the tags in a replica set configuration specify the operations to be read from the node with the least network latency?
Which of the following is incorrect statement about find and findOne operations in MongoDB?
As per the aggregation pipeline optimization concepts, if you have a $sort followed by a $match:
What method should be used to configure dynamically runtime parameters for the mongod process in MongoDB?
Consider a collection posts which has fields: Jd, post_text, post_author, post_timestamp, post_tags etc. Which of the following query retrieves ONLY the key named post_text from the first document retrieved?
Write the command(s) are correct to enable sharding on a database " testdb " and shard a collection " testCollection " with _id as shard key.
When should we consider representing a one-to-many relationship in an embedded collection instead of separate collection?
Which of the documents below will be retrieved by the following query? Assume the documents are stored in a collection called " sample " . Check all that apply.
db.sample.find( { " $or " : [ { " a " : { " $in " : [ 3, 10] > }, { " b " : { " $lt " : 2 > > ] > )
What is the equivalent command in MongoDB for the following SQL query?
SELECT * FROM posts WHERE author like " %john% "
What does the following $slice query return using the following command? db.posts.find( {}, { comments: { $slice: [ -10, 5 ] } } )
Which of the following does MongoDB use to provide High Availability and fault tolerance?
Addding the index {a:l} can potentially decrease the speed of which of the following operations? Check all that apply.
A MongoDB collection named users contains sample documents with fields including name, age, address, description, city, and occupation.
The administrator uses the following query to perform a collection scan:
db.users.find({ city: " New York " , occupation: " Software Engineer " })
What compound index will improve the performance of the query the MOST?
Consider an inventory collection that contains these documents:
{ " _id " : 1, " product " : " x-small box " , " colors " : [ " brown " , " black " , " white " ], " qty " : 50 }
{ " _id " : 2, " product " : " small box " , " colors " : [ " brown " , " white " ], " qty " : 60 }
{ " _id " : 3, " product " : " medium box " , " colors " : [ " black " , " grey " , " white " ], " qty " : 45 }
{ " _id " : 4, " product " : " large box " , " colors " : [ " grey " ], " qty " : 50 }
{ " _id " : 5, " product " : " x-large box " , " colors " : [ " grey " , " white " ], " qty " : 10 }
What result set does the following query return?
db.inventory.find({
$or: [
{ " product " : " x-small box " },
{
$and: [
{ " qty " : { $ne: 50 } },
{ " colors " : { $nin: [ " brown " ] } }
]
}
]
})
To add a new user and enable authentication in MongoDB, which of the following steps need be executed?
If the value of totalKeysExamined is 30000 and the value of totalDocsExamined is 0, which of the following option is correct?
What command should a MongoDB database administrator use to find the disk utilization of the order collection?
You are comparing values of different BSON types in mongodb. You want to compare from lowest to highest. Which comparison order is used?
A collection and a document in MongoDB is equivalent to which of the SQL concepts respectively?
A MongoDB administrator is managing a database for a hospital system.
The patients collection contains:
- Carlos Martinez, diagnosis Hypertension, room 203
- Maria Lopez, diagnosis Hypertension, room 207
- Juan Perez, diagnosis Arrhythmia, room 207
The administrator runs:
db.patients.updateMany(
{ diagnosis: " Hypertension " },
{ $set: { room: 207 } }
)
What output should the administrator expect?
You have designed a web application with mongoDB. You have configured replication. The replica set is in place and function properly. What happens in case of failure?
Which TWO commands can be used to check for all active operations on the current node?
The Production MongoDB Cluster contains Personally Identifiable Information, such as Name, Demographics, Date of Birth, and Government Identification Number. Due to strict compliance requirements, a database administrator is tasked to ensure a client ' s side encryption.
What feature should the administrator use to meet the requirement?
You perform the following operation in the shell: db.foo.insert( { } ); What gets inserted?
What is the first task that a secondary would perform on being prompted by another secondary for an election?
In a replica set with a primary and two secondaries, what should the write concern be set to so only a single node is required to acknowledge a write operation before it is deemed successful?
Given a collection posts as shown below having a document array comments, which of the following command will create an index on the comment author descending?
Suposse tou have the following collection with only 2 documents:
If you run an aggregation query and use { $unwind: " $traits " } as the first stage, how many documents will be passed to the next stage of the aggregation pipeline?
Consider the following document from the products collection:
What does the following query using $elemMatch return? db.products.find( { product_code: " 345678 " }, { variations: { $elemMatch: { size: ^L^ } } } )
What command adds a document to the class101 collection where the student is " Randall " and the student passed the class?
What command set removes node-1.cluster1.mycompany.local:27017 and node-2.cluster1.mycompany.local:27017 from the replica set, then adds node-1.cluster1.mycompany.local:27017 back to the replica set?
You perform the following query on the sayings collection, which has the index
{ quote : " text " }:
Assuming the documents below are in the collection, which ones will the following query return? Check all that
apply.
db.sayings.find( { $text : { $search : " fact find " } } )
What read preference should your application use if you want to read from the primary under normal circumstances but allow reads from secondaries when a primary is unavailable?
Which of the following needs to be performed prior to initiate backup on a sharded cluster?
Which of the following statements are true about the $match pipeline operator? Check all that apply.
Given a collection posts as shown below having a document array comments, which of the following command will create an index on the comment author descending?
You have a replicated cluster with 1 primary, 3 secondary, 1 arbiter. One of the secondary is hidden. What is the replication factor of this replicated cluster?