Pymongo gives db assertion failure while trying to access remote server

人走茶凉 提交于 2019-12-12 02:03:26

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!