问题
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:
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)
来源:https://stackoverflow.com/questions/6627611/pymongo-gives-db-assertion-failure-while-trying-to-access-remote-server