Challenge - 5 Problems
Atlas Connection Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ query_result
intermediate2:00remaining
What is the correct format of a MongoDB Atlas connection string?
Given the following connection string, what is the expected output when trying to connect to the database?
Assume the credentials are correct and the cluster is accessible.
mongodb+srv://user:password@cluster0.mongodb.net/myFirstDatabase?retryWrites=true&w=majorityAssume the credentials are correct and the cluster is accessible.
Attempts:
2 left
💡 Hint
Look carefully at the connection string format and parameters.
✗ Incorrect
The connection string uses the correct 'mongodb+srv' protocol, includes username, password, cluster address, and specifies the database 'myFirstDatabase'. The 'retryWrites' and 'w' parameters are valid options. No port is needed with 'mongodb+srv'.
📝 Syntax
intermediate2:00remaining
Identify the syntax error in this Atlas connection string
Which option contains a syntax error that will prevent connection to MongoDB Atlas?
Attempts:
2 left
💡 Hint
Check the query parameters and their separators.
✗ Incorrect
Option C ends with an extra '&' which is invalid syntax in a URI query string and will cause connection failure.
🧠 Conceptual
advanced2:00remaining
Why is the port number omitted in MongoDB Atlas connection strings using 'mongodb+srv'?
Select the correct reason why Atlas connection strings with 'mongodb+srv' do not include a port number.
Attempts:
2 left
💡 Hint
Think about how DNS SRV records work.
✗ Incorrect
The 'mongodb+srv' protocol uses DNS SRV records to discover the hosts and ports automatically, so the port number is not needed in the connection string.
🔧 Debug
advanced2:00remaining
Why does this connection string fail to connect to Atlas?
Given this connection string:
Why might the connection fail even if credentials are correct?
mongodb+srv://user:password@cluster0.mongodb.net/?retryWrites=true&w=majorityWhy might the connection fail even if credentials are correct?
Attempts:
2 left
💡 Hint
Check if the database to connect to is specified.
✗ Incorrect
The connection string does not specify a database name after the cluster address, so the driver may default to 'test' or fail depending on configuration.
❓ optimization
expert2:00remaining
Optimizing Atlas connection string for read preference
Which connection string option correctly sets the read preference to 'secondaryPreferred' for better read scalability?
Attempts:
2 left
💡 Hint
Check the exact parameter name and value format.
✗ Incorrect
The correct parameter is 'readPreference' with value 'secondaryPreferred'. Underscores or extra '=true' are invalid.