0
0
MongoDBquery~20 mins

Why managed databases matter in MongoDB - Challenge Your Understanding

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Managed Database Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Benefits of Managed Databases

Which of the following is NOT a typical benefit of using a managed database service?

AManual hardware maintenance by the user
BBuilt-in security and compliance features
CScalability with minimal downtime
DAutomatic backups and recovery
Attempts:
2 left
💡 Hint

Think about what tasks managed databases handle for you automatically.

query_result
intermediate
2:00remaining
Querying a Managed MongoDB Database

Given a managed MongoDB collection users with documents containing {name, age}, what is the output of this query?

db.users.find({ age: { $gt: 30 } }).count()
AList of users younger than 30
BNumber of users older than 30
CSyntax error due to incorrect query
DNumber of users exactly 30 years old
Attempts:
2 left
💡 Hint

Look at the $gt operator meaning.

📝 Syntax
advanced
2:00remaining
Correct MongoDB Update Syntax in Managed Database

Which option correctly updates the status field to active for all documents where lastLogin is older than 1 year?

MongoDB
db.users.updateMany({ lastLogin: { $lt: new Date(Date.now() - 365*24*60*60*1000) } }, { $set: { status: "active" } })
Adb.users.updateMany({ lastLogin: { $lt: new Date(Date.now() - 365*24*60*60*1000) } }, { $set: { status: "active" } })
Bdb.users.updateMany({ lastLogin: { $lt: new Date() - 365*24*60*60*1000 } }, { $set: { status: active } })
Cdb.users.update({ lastLogin: { $lt: new Date() - 365 } }, { $set: { status: "active" } })
Ddb.users.updateMany({ lastLogin: { $lt: Date.now() - 365*24*60*60*1000 } }, { status: "active" })
Attempts:
2 left
💡 Hint

Check the use of new Date() and the update operator $set.

optimization
advanced
2:00remaining
Improving Query Performance in Managed MongoDB

You have a managed MongoDB collection with millions of documents. Which option will most improve the performance of queries filtering by email?

AUse <code>find()</code> without any filter
BStore emails in a separate collection
CIncrease the size of the documents
DCreate an index on the <code>email</code> field
Attempts:
2 left
💡 Hint

Think about how databases speed up searches on specific fields.

🔧 Debug
expert
2:00remaining
Diagnosing Connection Issues with Managed MongoDB

You try to connect to your managed MongoDB instance but get a timeout error. Which option is the most likely cause?

AMissing <code>_id</code> field in documents
BIncorrect query syntax in your find command
CNetwork firewall blocking the connection
DUsing <code>updateOne</code> instead of <code>updateMany</code>
Attempts:
2 left
💡 Hint

Timeout errors usually relate to connectivity, not query syntax.