Which command is used to create an index in MongoDB?
db.collection.addIndex()
db.collection.insertIndex()
db.collection.ensureIndex()
db.collection.createIndex()
Which data type would you use to store a date and time in MongoDB?
string
datetime
date
timestamp
Which of the following is NOT a key consideration when designing a schema in MongoDB?
Query patterns and performance requirements
Data relationships and access patterns
Data normalization to eliminate redundancy
Document size and growth potential
What is the role of the MongoClient object in a MongoDB Node.js application?
MongoClient
To create and manage user accounts
To execute queries against the database
To define the database schema
To establish a connection to the MongoDB server
How do you delete a database in MongoDB?
drop database
erase database
delete database
remove database
What is the primary difference between SQL and MongoDB's data models?
SQL is table-based, MongoDB is document-based.
SQL is NoSQL, MongoDB is relational.
SQL uses JSON, MongoDB uses BSON.
SQL is document-based, MongoDB is table-based.
What is the function of the $project stage in the aggregation pipeline?
$project
To group documents based on shared values.
To reshape and transform the structure of output documents.
To sort documents in ascending or descending order.
To filter documents based on matching criteria.
In the context of the $group stage, what does the _id field represent?
$group
_id
The unique identifier of the document within the collection.
The total number of documents processed by the aggregation pipeline.
The field used to group documents together based on a shared value.
A placeholder for a calculated aggregate value.
Which data type in MongoDB is used to store decimal numbers?
decimal
int
double
numberDecimal
After adding the MongoDB repository to your system's package manager, which command updates the package list and installs the MongoDB server package?
sudo systemctl start mongod
sudo apt-get install -y mongodb-org
mongod
mongorestore