Can't perform any actions on Mongo using C# driver

253 views
Skip to first unread message

Ron Rejwan

unread,
Jun 19, 2013, 4:13:51 AM6/19/13
to mongod...@googlegroups.com
Hey everyone,
I've recently upgraded my Mongo to 2.4.4 and the same code that worked perfectly well now doesn't work at all.
Any action I try to perform (using the C# driver) will return more or less the same error message:

{"WriteConcern detected an error 'not authorized for insert on JellyDB.DebugMessages'. (Response was { \"err\" : \"not authorized for insert on JellyDB.DebugMessages\", \"code\" : 16544, \"n\" : 0, \"connectionId\" : 63, \"ok\" : 1.0 })."}

Now the user I'm connected through is an admin and has the "dbAdmin" user role assigned to him - and using the same commands from the Mongo shell work perfectly well.

Looking around the web I found no one with the same problem as me :(

Asya Kamsky

unread,
Jun 22, 2013, 10:00:28 AM6/22/13
to mongod...@googlegroups.com
Is your code authenticating against the correct database?
More importantly, when you say that you can do the same actions in the shell are you doing the same commands against the same database to auth and insert in both cases?

craiggwilson

unread,
Jun 22, 2013, 1:24:48 PM6/22/13
to mongod...@googlegroups.com
Can you provide the code you are using to initialize your MongoClient?  If you are using a connection string, could you please include that.  Also, what version of the driver are you using?
Message has been deleted

Sridhar

unread,
Jul 19, 2013, 7:24:13 PM7/19/13
to mongod...@googlegroups.com
What version of the driver are you using? As seen from the docs page at http://docs.mongodb.org/manual/reference/user-privileges/, the user needs readWrite role to be able to insert into a collection. Quick test confirms this. I created  a db with 3 diff users 1 with readWrite, 1 with dbAdmin and 1 with both. I can insert with the 2 users who have the readWrite. With the user who has just dbAdmin privileges I get the not authorized error from both the driver and the mongodb shell.
From the shell
> db.auth("testdbadmin","*******")
> db.coll.insert({foo:1})
not authorized for insert on test.coll
Reply all
Reply to author
Forward
0 new messages