In a MongoDB cluster, which component acts as a query router and distributes requests to the appropriate shards?
Mongos
Config Server
Replica Set
Primary Node
What is the command to list all databases in a MongoDB instance?
show databases
all databases
display databases
list databases
Which aggregation stage is used to filter documents based on specified criteria?
$project
$sort
$group
$match
How do you drop an index named "itemName_1" on the "products" collection?
db.products.removeIndex("itemName_1")
db.products.drop("itemName_1")
db.products.dropIndex("itemName_1")
db.products.deleteIndex("itemName_1")
When is it generally preferred to embed data in a document rather than referencing it in MongoDB?
When the related data is frequently accessed together with the main document
When maintaining data integrity across multiple collections is crucial
When the related data is rarely accessed
When minimizing document size is a top priority
What is the purpose of replica sets in MongoDB?
Query Optimization
Data Sharding
Load Balancing
High Availability and Data Redundancy
Referencing in MongoDB involves:
Creating a link (usually an ObjectId) to the related document in another collection
Merging multiple documents into a single entity
Storing a copy of the related data within the main document
Defining a strict one-to-one relationship between documents
What is a collection in MongoDB?
A group of databases
A specific data type
A table-like structure containing documents
A user account
Which operator is commonly used within a $group stage to calculate the sum of a specific field?
$push
$max
$avg
$sum
What is the default data directory for MongoDB?
/log/mongodb.log
/etc/mongodb.conf
/var/lib/mongodb
/bin/mongod