Reputation: 51
I have upgraded my MongoDB to 3.0.2 from 2.4.10. I am having the database "abc"
with user as "xt"
. I can able to do crud operation after authenticating using db.authenticate()
but I am not able to run the eval
command. It throws the error as
Unauthorized not authorized on abc to execute command { $eval: "deleteDetails()" }
When I check the admin database system.users
collection for the database user is
{
"_id" : "abc.xt",
"user" : "xt",
"db" : "abc",
"credentials" : {
"SCRAM-SHA-1" : {
"iterationCount" : 10000,
"salt" : "mydgFCRFo05wh616qw6g1g==",
"storedKey" : "c8YfzCZZ1qqw2EM8MRDQugQFk4s=",
"serverKey" : "4JVLAIevhbJI6PtdDRRbelJa4pU="
}
},
"roles" : [
{
"role" : "dbOwner",
"db" : "abc"
}
]
}
Can anyone tell, what may be the problem and also I saw that eval is deprecated, if so what can be the alternative for using in both mongo shell and node js.
Upvotes: 0
Views: 432
Reputation: 73
As of 2.6 they made the eval command require superuser access to the database so as a dbOwner you don't have enough access. I'm researching this myself and I believe the command/runCommand might work to replace eval since it is now deprecated.
Upvotes: 1