MongoDb在3.0之后添加了SCRAM-SHA-1,用户验证模式。添加的用户,默认登录协议也是这个。

在登陆的时候就要选择使用这种方式登录。有的gui客户端的登录验证方式还是MONGODB-CR。因此会验证失败,错误日志信息:

Failed to authenticate user@db with mechanism MONGODB-CR: AuthenticationFailed: MONGODB-CR credentials missing in the user document

使用命令 db.system.users.find(),可以查看用户的登录验证协议,如:

{ "_id" : "userdb.myuser", "user" : "myuser", "db" : "userdb",
"credentials" : { "SCRAM-SHA-1" : { "iterationCount" : 10000,
"salt" : "XXXXXXXXXXXXXXXXXXXXXXXX", "storedKey" : "XXXXXXXXXXXXXXXXXXXXXXXXXXX", "serverKey" : "XXXXXXXXXXXXXXXXXXXXXXXXXXX" } }
, "roles" : [ { "role" : "dbOwner", "db" : "userdb" } ] }

在使用C# Driver操作mongo时,如果驱动版本小于1.10,就连接不上。必须要大于1.10版本,使用字符串方式,就可以连接了。

mongodb://user:pwd@127.0.0.1:2222/db

也可以修改,用户的验证协议,这种方式显然是不推荐的,可参考:http://21jhf.iteye.com/blog/2216103。

C# Driver 1.10版本:http://files.cnblogs.com/files/zhaoyihao/CSharpDriver-1.10.1.zip

MongoDB-C# Driver账户密码登录问题的更多相关文章

  1. MongoDB C Driver Building on Windows

    一.编译mongodb c driver: 需要先安装OpenSSL:(参见:http://bbs.aircheng.com/read-2222-1) 步骤:(MongoDB步) 1.下载Active ...

  2. MongoDB Java Driver操作指南

    MongoDB为Java提供了非常丰富的API操作,相比关系型数据库,这种NoSQL本身的数据也有点面向对象的意思,所以对于Java来说,Mongo的数据结构更加友好. MongoDB在今年做了一次重 ...

  3. MongoDB C Driver使用教程

    MongoDB C Driver使用教程 转载请注明出处http://www.cnblogs.com/oloroso/ 本指南提供简介 MongoDB C 驱动程序. 在 C API 的详细信息,请参 ...

  4. windows平台下安装、编译、使用mongodb C++ driver

    本博客将记录在Win8.1 ,VS2013环境下编译.配置mongodb C++ driver的流程. 1.下载预备 下载Boost:http://sourceforge.net/projects/b ...

  5. Ignoring Extra Elements in mongoDB C# Driver

    MongoDB删除字段后会报错: Element ... does not match any field or property of class Customer. 需要在实体类增加 [BsonI ...

  6. mongodb .net driver

    1.介绍 The official MongoDB .NET Driver provides asynchronous interaction with MongoDB. Powering the d ...

  7. Mongodb Java Driver 参数配置解析

    要正确使用Mongodb Java Driver,MongoClientOptions参数配置对数据库访问的并发性能影响极大. connectionsPerHost:与目标数据库能够建立的最大conn ...

  8. mongodb c++ driver(2.53)windows编译

    编译环境: (1) 下载python2.7, 使用x86_32位,因为scons只有32位安装包可用: (2) 下载scons2.3.0,The current production release ...

  9. MongoDB C Driver and APIinstances linux MongoDB安装配置

    <一,linux平台MongoDB安装配置>在这我们使用的Centos6 yum部署的,你想搞编译,自个干!

随机推荐

  1. vs2012远程调试

    不知道大家有没有遇到过这种情况,刚开发完的程序,明明在本机能够好好的运行,可是部署到服务器过分发给用户时,总是出现莫名其妙的错误. 一时半会又看不出问题来,怎么办呢?难道只能在服务器或是客户电脑上装一 ...

  2. Js判断密码强度并显示提示信息

    用javascipt实现的Ajax判断密码强弱的功能,大多数有用户注册功能的网站,都会有这么一个功能,作为WEB程序员,应该会写这种小模块哦,不懂的就看下这个例子,觉得挺简单,当初帮助了不少人学会了密 ...

  3. .NET MVC 插件化框架支持原生MVC的Area和路由特性

    前面开放的源码只是简单的Plugin的实现,支持了插件的热插拔,最近晚上偶然想到,原生的MVC提供Areas和RouteAtrribute等路由特性标签,按照先前的做法,无法解析插件的路由特性和Are ...

  4. AD:想两VIA在同一plane层不同连接(两VIA接同网络),一全连接、一花孔接,实现方法

    可以用room方法处理!

  5. intrins.h 里面的函数都有什么,功能是什么?

    是c51中的intrins.h库 _crol_  字符循环左移 _cror_ 字符循环右移 _irol_   整数循环左移 _iror_  整数循环右移 _lrol_   长整数循环左移 _lror_ ...

  6. [Operationg System Labs] 我对 Linux0.00 中 boot.s的理解和注释

    (如有错误请立即指正,么么哒!) !    boot.s!! It then loads the system at 0x10000, using BIOS interrupts. Thereafte ...

  7. Windows服务器Pyton辅助运维--03.安装Visual Studio 的 Python 开发插件 PTVS

    PTVS (Python Tools for Visual Studio) http://pytools.codeplex.com/ 当前版本:2.1 RC PTVS (Python Tools fo ...

  8. How to Read an Engineering Research Paper

    How to Read an Engineering Research Paper William G. Griswold Department of Computer Science & E ...

  9. sicily 1024 Magic Island

    题意:求无向图路径中的最大带权值. 解法:深搜 // Problem#: 9859 // Submission#: 2661875 // The source code is licensed und ...

  10. java的动态代理设计模式

    代码实现: package com.lky.proxy; import java.lang.reflect.InvocationHandler; import java.lang.reflect.Me ...