Final Exam: Question Three

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;

There is an error in the example code above. It will cause a compilation error because you cannot assign settings to the client.Settings. It’s a read-only property.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.