0
0
MongoDBquery~20 mins

What is MongoDB - Practice Questions & Exercises

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
MongoDB Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
1:30remaining
What type of database is MongoDB?
MongoDB is best described as which type of database?
AA document-oriented NoSQL database that stores data in JSON-like documents
BA relational database that uses tables and rows
CA graph database that stores data as nodes and edges
DA key-value store that only supports simple key-value pairs
Attempts:
2 left
💡 Hint
Think about how MongoDB stores data compared to traditional databases.
🧠 Conceptual
intermediate
1:30remaining
Which feature is a key advantage of MongoDB?
What is a main advantage of using MongoDB over traditional relational databases?
AIt requires a fixed schema before storing data
BIt cannot scale horizontally across servers
CIt only supports SQL queries
DIt supports flexible schemas allowing different documents to have different structures
Attempts:
2 left
💡 Hint
Think about how MongoDB handles data structure changes.
query_result
advanced
2:00remaining
What is the output of this MongoDB query?
Given a collection 'users' with documents: {name: 'Alice', age: 30}, {name: 'Bob', age: 25}, what does this query return? db.users.find({age: {$gt: 27}})
MongoDB
db.users.find({age: {$gt: 27}})
A[{name: 'Alice', age: 30}]
B[{name: 'Bob', age: 25}]
C[]
DSyntaxError
Attempts:
2 left
💡 Hint
Look for users with age greater than 27.
📝 Syntax
advanced
2:00remaining
Which MongoDB query syntax correctly updates a user's age?
You want to update the age of the user named 'Bob' to 28. Which query is correct?
Adb.users.modify({name: 'Bob'}, {$set: {age: 28}})
Bdb.users.update({name: 'Bob'}, {age: 28})
Cdb.users.updateOne({name: 'Bob'}, {$set: {age: 28}})
Ddb.users.updateOne({name: 'Bob'}, {age: 28})
Attempts:
2 left
💡 Hint
Remember the correct update operator and method name.
optimization
expert
2:30remaining
How to improve query performance in MongoDB?
You have a large collection and queries on the 'email' field are slow. What is the best way to improve query speed?
AIncrease the RAM of the server without changing the database
BCreate an index on the 'email' field
CUse $where with JavaScript to filter emails
DStore emails in a separate collection
Attempts:
2 left
💡 Hint
Indexes help databases find data faster.