Mongodb身份验证

问题描述:

如何通过官方C#驱动程序对mongodb使用身份验证?除了内部成员外,我找不到任何要进行身份验证的API方法.

How do I use authentication with mongodb via the official c# driver? I can't find any API methods to authenticate, other than internal members.

应使用以下连接字符串格式在您的连接字符串中指定身份验证凭据:

Authentication credentials should be specified in your connection string, using the following connection string format:

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

MongoDB C#驱动程序教程中查看完整的详细信息