1

I am getting the following error:

db assertion failure, assertion: 'unauthorized db:db1 lock type:-1 client:', assertionCode: 10057

I am able to access the MongoDB database by running python on the shell of my server. But when I try to access my site i get this unauthorised errors.

Any fix for this error?

1 Answer 1

5

This means that your database is using authentication. In such a setup, you must authenticate a valid user before you can perform any operations (queries, commands, updates, etc). You can do so with the db.auth(username, password) helper in the mongo shell (described in the MongoDB docs), and with Python, you can use the authenticate(username, password) method of the Database object (described in the PyMongo docs)

Sign up to request clarification or add additional context in comments.

4 Comments

i am trying that now...but isnt this authentication required when i am accessing the database from my shell coz i am able to do that without authentication
There's a bug in PyMongo right now where each thread needs to re-authenticate, since the authentication credentials are not cached in the driver. This bug should be fixed in 1.12.
k..thnx a lot and when is that due
You can follow the progress of pymongo releases here: jira.mongodb.org/browse/PYTHON

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.