this is the php code I used to add the user "someuser" to the "someusersdatabase".
<?
// open connection
$mongo = new Mongo("mongodb://admin:passwd@remotemongoserver:27017");
$db = $mongo->selectDB("someusersdatabase");
$mongo->selectDB("someusersdatabase")->createCollection('__tmp_collection_');
$mongo->selectDB("someusersdatabase")->dropCollection('__tmp_collection_');
// $collections = $db->selectCollection("tmp");
// $collections->insert(array('t' => '1'));
// user info to add
$username = "someuser";
$password = "apassword";
// insert the user - note that the password gets hashed as 'username:mongo:password'
// set readOnly to true if user should not have insert/delete privs
$collection = $db->selectCollection("system.users");
$collection->insert(array('username' => $username, 'pwd' => md5($username . ":mongo:" . $password), 'readOnly' => false));
I can authenticate as admin, however when I authenticate someuser the log shows:
Mon Jun 27 14:01:38 [initandlisten] connection accepted from client:62708 #1
Mon Jun 27 14:01:38 [conn1] auth: couldn't find user someuser, someusersdatabase.system.users
but when I navigate to the web view, it displays both someusersdatabase and someusersdatabase.system.users
So is the user not being added properly? no error is being thrown when the php code runs...