Final Question 3 M220JS

In dealing with this question, I printed out the properties of the testClient.s.options object.

I was surprised to find authsource and replicaset listed twice.

How did you manage to create two properties with the same name?
Is this a bug in your driver software?

This does not affect answering the question since both properties have the same value. Here is the result of listing Object.getOwnPropertyNames(clientOptions)

[ 'servers',
  'ssl',
  'authsource',
  'replicaset',
  'authSource',
  'replicaSet',
  'username',
  'password',
  'db',
  'auth',
  'user',
  'dbName',
  'connectTimeoutMS',
  'retryWrites',
  'useNewUrlParser',
  'socketTimeoutMS',
  'promiseLibrary' ]

Rob Tamlyn

replicatset vs replicaSet
authsource vs authSource

I guess it is case sensitive.

Hi,

My 1st attempt to select all the right answers for this question failed…

So, in order to get this one right, I added all the settings that are mentioned in this question into a javascript, which simply makes the connection with these settings and then logs all the clientOptions that are asked in this question, onto the console.

However, I assume that the expectation was to know all the clientOptions by looking at the settings provided, rather than printing them from a script? :grimacing::grimacing:

Furthermore, the below URI mentioned in the question was not up and running, so in order to run my javascript, I used my Atlas cluster connection string that I am using for connecting to my Mflix db.

const URI = "mongodb+srv://m220-user:m220-pass@m220-test.mongodb.net/test"

I hope, the approach of running a mock script for this question is acceptable? :grimacing::grimacing::slightly_smiling_face:

Hi @PuneetC,

I don’t see any harm in finding the answer through a script. :slight_smile:

The motive is to make everyone understand the meaning of different connection parameters and the reason why those tests will fail/pass.

Kanika

Hi,
To reply correctly this question, I need more documentation, because M220JS give a few information about how to set up a connexion. Please help.

How to print out the properties of the testClient.s.options object.

Hi everybody,
According to MongoDB’s directive, all discussions about exam question are not permitted in this forum.