[CSHARP-324] Connect to mongod with auth fails Created: 14/Sep/11 Updated: 27/May/22 Resolved: 14/Sep/11 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | None |
| Affects Version/s: | 1.2 |
| Fix Version/s: | 1.2 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Robert Stam | Assignee: | Robert Stam |
| Resolution: | Done | Votes: | 1 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Server Compat: | 2.0, 2.1 | ||||||||||||||||
| Backwards Compatibility: | Minor Change | ||||||||||||||||
| Description |
|
The driver uses buildInfo at connect time to get information about the server build and version, but buildInfo fails if mongod is running with auth. Note: the behavior of buildInfo changed in release 2.0 of the server. Before, the buildInfo command did not require credentials, but now it does. |
| Comments |
| Comment by Robert Stam [ 14/Sep/11 ] |
|
There will probably be a better fix to this issue in future versions of the driver. Either the server will change to not require credentials for buildInfo, or the driver will provide a way for you to supply credentials before calling Connect so that buildInfo can succeed. In the meantime, your code should be prepared to handle null values for server.BuildInfo when auth is on. |
| Comment by Robert Stam [ 14/Sep/11 ] |
|
Fixed for now by simply setting the BuildInfo property of MongoServerInstance to null when connecting to a server that refused to return buildInfo data because auth is on. This is slightly backward breaking because if you are using auth you now no longer have access to the BuildInfo for the server. But at least you can connect... |
| Comment by Robert Stam [ 14/Sep/11 ] |
|
Still investigating, but apparently there has been a change at the server where buildInfo now requires credentials when it didn't used to. Will have a fix before long. |
| Comment by Brandon Linton [ 14/Sep/11 ] |
|
Just experienced this in a painful way....here's the exception we saw: MongoDB.Driver.MongoConnectionException: Unable to connect to server. ---> MongoDB.Driver.MongoCommandException: Command 'buildinfo' failed: need to login (response: { "errmsg" : "need to login", "ok" : 0.0 }) |