Details
-
Bug
-
Resolution: Done
-
Major - P3
-
0.94.2
-
None
-
None
-
Minor Change
Description
This commit fixes the authentication command not being sent when using the replicaSet option in the uri.
For example:
Start a single node replicaset with auth:
$ mongod --auth --dbpath replset/ --replSet db01
|
Add a user with the appropriate roles to read from any database:
use test
|
db.test.insert({})
|
use admin
|
db.addUser({ user:"usr", pwd:"pwd", roles: ["readWriteAnyDatabase"]}) |
cd mongo-c-driver-0.94.2
|
./example-client mongodb://usr:pwd@localhost/?replicaSet=db01
|
2014/05/20 10:09:43.0299: [13722]: INFO: cluster: Client initialized in replica set mode.
|
2014/05/20 10:09:43.0299: [13722]: DEBUG: cluster: Reconnecting to replica set.
|
2014/05/20 10:09:43.0300: [13722]: DEBUG: cluster: Registering potential peer: localhost.localdomain:27017
|
2014/05/20 10:09:43.0300: [13722]: DEBUG: cluster: Registering potential peer: localhost.localdomain:27017
|
Cursor Failure: not authorized for query on test.test
|