I have two databases admin and testdb ; Added a user Alice in the test database
db.addUser( { user: "Alice",pwd: "Moon1234",roles: [ "readWrite" ] } );
But when I login using the user Alice, I can run "use admin" and run all read queries on that database.
Then I tried doing this:
db.addUser( { user: "Alice",userSource: "testdb",roles: [ "readWrite" ] } )
I get this error:
uncaught exception: couldn't add user: 'testdb' is not a valid value for the userSource field in testdb.system.users entries
Mongodb documentation is not very clear about it.
Basically my use case is that Alice should be able to read write ONLY in the "testdb"