About Final Question 3 -

This is final question #3

Problem:

Suppose an instance of MongoClient is created with the following settings:

var client = new MongoClient("mongodb+srv://m220-user:m220-pass@m220-test.mongodb.net/test");
MongoClientSettings settings = new MongoClientSettings()
{
    ConnectTimeout = TimeSpan.FromMilliseconds(50),
    RetryWrites = true
}
client.Settings = settings;

Please find the documentation on Connection String URI Format here. The variable representing our client, client, will:

  • [A] allow a maximum of 50 connections in the connection pool.
  • [B] automatically retry writes that fail.
  • [C] use SSL when connecting to MongoDB.
  • [D] wait at most 50 milliseconds before timing out a connection.

The correct answer is B,C,D.

This question gave me some problems; I had no idea that ssl is set to true by default. I looked into the documentation and couldn’t find the answer.

Can you please tell me what, from the connection string, tells us that SSL is set to true?
THANK YOU,
Horia.

1 Like

Hi @Horia_Neamtu1,

I understand the confusion, but starting with mongodb+srv string (> 3.6 version), SSL is by default set to be true. You can find this in our documentation here:

Use of the +srv connection string modifier automatically sets the tls (or the equivalent ssl ) option to true for the connection. You can override this behavior by explicitly setting the tls (or the equivalent ssl ) option to false with tls=false (or ssl=false ) in the query string.

Also, at any point you feel the documentation or course is missing something or can be explained better, do not hesitate to submit feedback :slight_smile:

Kanika

2 Likes

Thank you very much for your prompt reply @kanikasingla.

Everything is clear now.

1 Like