This 2 days learning mongodb3.2.9, the user set up, the results in C # query when the error, to see the literal meaning of the user verification did not pass, but I use the shell is completely no problem, and then the Internet search, found that I used the old driver, the old driver is the old check mode, And mongodb3.2.9 is using the new scram-sha-1 check, so the verification will not pass
My side because of the software environment problems and want to continue to use the old drive, it needs to be in MongoDB to change the calibration method
First, turn off the Auth authentication start service first
D:
CD D:\MongoDB\Server\3.2\bin
Mongod--dbpath D:\mongodb\data
And then Modify the System.version Authschema CurrentVersion is 3, the default is 5 (without creating a user version is null, create a user version is created, this time the user's authentication method is the default 5, so it is to be deleted)
> Use admin
Switched to DB admin
> var s= db.system.version.findOne ({"_id": "Authschema"})
> s.currentversion = 3
3
> Db.system.version.save (s)
Writeresult ({"nmatched": 1, "nupserted": 0, "nmodified": 1})
This time the verification method is modified, and then the user to create the authentication method will become 3.
>use Admin>db.createuser ({User: "admin", pwd: "admin", Roles:[{role: "Root", DB: "admin"}]) Finally, start the service with Auth, Can be verified with the old driver D:
CD D:\MongoDB\Server\3.2\bin
Mongod--dbpath D:\mongodb\data
-auth
MongoDB C # connection error Invalid credentials for database ' admin '