Final 3 M220JS AuthSource

I was wondering why this answer is correct:

expect(clientOptions.authSource).toBe(“admin”)

In the documentation it is stated that:
“Specify the database name associated with the user’s credentials. [ authSource ] defaults to the database specified in the connection string.” - https://docs.mongodb.com/manual/reference/connection-string/#urioption.authSource

The database specified in the connection string is test:
mongodb+srv://m220-user:m220-pass@m220-test.mongodb.net/test

So why is the documentation saying different?

1 Like

Hi @Sami_Barasi_30522,

Thanks for reporting this. I have forwarded the issue, our team is currently working on this one.

Kanika

You are right. Well, I have chosen that option to get pass that Test, but I think this is an error for that you said.

The test answer says that “admin” is choosen by default, which correlates with my observations. The documentation seems to be incorrect because the value of authSource isn’t “test” or at least it is not clear to me which database is meant in the sentence: " [ authSource ] defaults to the database specified in the connection string.”