Connection Pooling / Handling Timeout - The return from the api was incorrect

for this course I did’nt use Atlas for DB connection, but I imported the db locally with mongorestore to localhost. I’ve set correctly the connection string in with these parameters:


both tests pass successfully, but in the status page in “Connection Pooling” and “Handling Timeout” I have this error: “The return from the api was incorrect”.

What I can do for these tickets?

Hi @Demone,

Did you enabled authorization in your MongoDB localhost deployment ?
The all course validation assumes that you are using an set of username and credentials, given that those are security best practices, and that there is no way to avoid it in Atlas.

If you are not, please do enable auth and set the credentials in your MongoDB connection string.

That is the reason why you are not validating this lab. Also, you need it for the upcoming labs.


1 Like

Thanks a lot, I completed all my tickets :wink:

PS: I use passwordDigestor: “server” option in db.createUser command, because SCRAM-SHA-256 requires undigested passwords and it raise an error


I’ve made appropriate changes to MongoDBConfiguration:

ConnectionString connString = new ConnectionString(connectionString);
MongoClientSettings settings = MongoClientSettings.builder()
.writeConcern(WriteConcern.MAJORITY.withWTimeout(2500, TimeUnit.MILLISECONDS))
MongoClient mongoClient = MongoClients.create(settings);

and to url:

The ConnectionPoolingTest and TimeoutsTest are passing. But I get this message for both validation on status page:

“The return from the api was incorrect”

What have I missed / done wrong?

Thanks for sharing the code.
Can you please try re-arranging this code? Or maybe appending wtimeout=2500 in the url ?

MongoClientSettings settings = MongoClientSettings.builder()
.writeConcern(WriteConcern.MAJORITY.withWTimeout(2500, TimeUnit.MILLISECONDS))

Let me know if it works.