阅读背景:

通过Cloud 9进行远程MongoDB访问会导致登录失败异常

来源:互联网 

I'm using the Cloud 9 IDE to develop an application using MongoDB. I created a database called "appdata" at MongoLab and the following user:

我正在使用Cloud 9 IDE使用MongoDB开发应用程序。我在MongoLab和以下用户创建了一个名为“appdata”的数据库:

{
"_id": "appdata.admin",
"user": "admin",
"db": "appdata",
"credentials": {
    "SCRAM-SHA-1": {
        "iterationCount": 10000,
        "salt": "K/WUzUDbi3Ip4Vy59gNV7g==",
        "storedKey": "9ow35+PtcOOhfuhY7Dtk7KnfYsM=",
        "serverKey": "YfsOlFx1uvmP+VaBundvmVGW+3k="
    }
},
"roles": [
    {
        "role": "dbOwner",
        "db": "appdata"
    }
]
}

Whenever I try connecting to the database through Cloud 9 Shell using the following command (given by MongoLab with my newly created user):

每当我尝试使用以下命令通过Cloud 9 Shell连接数据库时(由MongoLab与我新创建的用户一起提供):

mongo ds057244.mongolab.com:57244/appdata -u admin -p admin 

I get the following error message:

我收到以下错误消息:

MongoDB shell version: 2.6.11
connecting to: ds057244.mongolab.com:57244/appdata
2015-11-22T05:23:49.015+0000 Error: 18 { ok: 0.0, errmsg: "auth failed",
code: 18 } at src/mongo/shell/db.js:1292
exception: login failed

Also, on my javascript file running on Cloud 9, while following this tutorial (which uses mongoose to access the DB) I got stuck on the post route for bears. Whenever I send a post request through postman with the specified fields set, the route doesn't return anything, neither a bear created nor an error message, which makes me think the problem is also failing to login to the database. The previous get request is working just fine and my code is the exactly same as the tutorial.

另外,在我在Cloud 9上运行的javascript文件中,在遵循本教程(使用mongoose访问数据库)的同时,我陷入了对于熊的邮寄路线。每当我通过设置指定字段的邮递员发送邮件请求时,路由不会返回任何内容,既不会创建熊也不会返回错误消息,这使我认为问题也无法登录到数据库。以前的get请求工作正常,我的代码与教程完全相同。

Does anyone know what the problem in any of the cases and what I need to do to solve them?

有谁知道在任何情况下的问题以及我需要做些什么来解决它们?

1 个解决方案

#1


0  

  1. The shell problem was fixed updating it to the Database version (which was 3.0.3).
  2. 修复了shell问题,将其更新为Database版本(3.0.3)。
  3. For the javascript files, I restarted the tutorial and made sure I downloaded all necessary dependencies with the most recent stable version (not the ones shown on the tutorial), after that the problem was solved.
  4. 对于javascript文件,我重新启动了教程并确保使用最新的稳定版本(不是教程中显示的版本)下载了所有必需的依赖项,之后问题得以解决。

分享到: