Pymongo在尝试访问远程服务器时给出数据库断言失败 [英] Pymongo gives db assertion failure while trying to access remote server

查看:182
本文介绍了Pymongo在尝试访问远程服务器时给出数据库断言失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到以下错误:


db断言失败,断言:'未经授权的db:db1锁类型:-1客户端: ',assertionCode:10057

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

我可以通过在我的服务器的shell上运行python来访问MongoDB数据库。但是当我尝试访问我的网站时,我会收到这个未经授权的错误。

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.

任何修复此错误?

推荐答案

这意味着您的数据库正在使用身份验证。在这样的设置中,您必须先验证有效的用户,然后才能执行任何操作(查询,命令,更新等)。您可以使用mongo shell中的 db.auth(username,password)帮助器(),使用Python可以使用 authenticate(username,password) / code>数据库的对象(

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)

这篇关于Pymongo在尝试访问远程服务器时给出数据库断言失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆