What value for the index specification sorts in descending order?
0
null
1
-1
Which command in the MongoDB shell displays all available databases?
db.getDatabases()
show databases
show dbs
list databases
Which of the following is NOT a valid CRUD operation in MongoDB?
Update
Delete
Retrieve
Create
What does the findOne() method in MongoDB return?
findOne()
All documents in the collection
The first matching document
An array of matching documents
The number of matching documents
What is the function of the $project stage in the aggregation pipeline?
$project
To reshape and transform the structure of output documents.
To filter documents based on matching criteria.
To group documents based on shared values.
To sort documents in ascending or descending order.
Which data type would you use to store a date and time in MongoDB?
timestamp
date
string
datetime
Which update operator replaces the value of a field with a specified value?
$rename
$push
$inc
$set
Why might you drop and recreate an index instead of just updating it?
To rename the index
All of the above
To change the index type
To improve query performance after significant data changes
What is the difference between deleteOne() and deleteMany() in MongoDB?
deleteOne()
deleteMany()
deleteOne() deletes documents permanently, while deleteMany() moves them to the trash.
There is no difference; both commands perform the same action.
deleteOne() deletes the first matching document, while deleteMany() deletes all matching documents.
deleteOne() deletes all documents, while deleteMany() deletes only the specified number of documents.
The Attribute Pattern in MongoDB is best suited for:
Storing a large, sparse matrix of data
Optimizing geospatial queries for location-based data
Managing evolving schemas and varying attributes for different documents
Representing hierarchical relationships between entities