Authentication in mongodb

The connection string for mongodb C # is as follows:

mongodb://[username:password@]hostname[:port][/[database][?options]] 

Does the connection string itself implement authentication?

I saw the C # API driver. It has 4 authentication methods: `authentication, canAuthenticate, isAuthenticated and Authenticate, but they are internal. Please let me know about this? I really need it. Thanks in advance.

+5
source share
1 answer

Yes you can.

mongodb://[username:password@]hostname[:port][/[database][?options]]

And the official documentation for CSharp Driver reads:

, MongoDB. . "(admin)" . , GetDatabase.

.

, MongoDB,

MongoServer.GetDatabase(String, MongoCredentials)

.

+7

All Articles