My databases have their own users set, and now I want to eval certain functions, like:
function() {
db.mydatabase.ensureIndex(<fields>, <options>);
}
But that never works, I get an unauthorized error.
But the user IS authorized and authenticated. If now, I wouldn't be able to connect. The user also has the dbAdmin role set, which I thought was needed for version 2.4 and up.
I tried to login using an admin user, but that doesn't work unless you log into the admin database itself.
This is the user of 'mydatabase':
{ "_id" : ObjectId("534290d2bfeb13f0b91d52d3"), "user" : "myuser", "pwd" : "blabla", "roles" : [ "read", "readWrite", "dbAdmin", "userAdmin", "clusterAdmin", "readAnyDatabase", "readWriteAnyDatabase", "userAdminAnyDatabase", "dbAdminAnyDatabase" ] }