无法使用shell在heroku连接到mongohq [英] Unable to connect to mongohq at heroku using shell

查看:117
本文介绍了无法使用shell在heroku连接到mongohq的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Heroku上安装了 mongohq:​​sandbox 。当我想连接到mongo时,发生错误:

  mongo linus.mongohq.com:10123/app10575123 -u my_user -p pwd123 
MongoDB shell版本:2.2.2
连接到:linus.mongohq.com:10123/app10575123
> show dbs
Wed Jan 9 06:00:50未捕获异常:listDatabases失败:{errmsg:需要登录,ok:0}

登录名和密码正确。 到MongoHQ的共享数据库计划(特别是沙箱),出于安全原因,它们不包括对Mongo实例的管理级访问......只能访问您的实际数据库。



show dbs是一个管理员级别的命令,在这种情况下,它将在沙盒MongoDB进程中显示其他数据库。



相反,您需要使用以下命令:


  • 显示集合

  • db。[collection_name ] .findOne()

  • db.stats()

  • db。[collection_name] .stats() li> db。[collection_name] .ensureIndex({foo:1,bar:1},{background:true})


    ..等等。



    我希望这有助于!


    I installed mongohq:sandbox at Heroku. When I want to connect to mongo, it occurs an error:

    mongo linus.mongohq.com:10123/app10575123 -u my_user -p pwd123
    MongoDB shell version: 2.2.2
    connecting to: linus.mongohq.com:10123/app10575123
    > show dbs
    Wed Jan  9 06:00:50 uncaught exception: listDatabases failed:{ "errmsg" : "need to login", "ok" : 0 }
    

    Login and password are correct.

    解决方案

    You are connected to the database, but for the shared database plans at MongoHQ (especially the sandbox ones), for security reasons, they do not include admin-level access to the Mongo instance ... only access to your actual database.

    "show dbs" is an admin-level command and, in this case, would show other databases on that sandbox MongoDB process.

    Instead, you will want to use commands like:

    • show collections
    • db.[collection_name].findOne()
    • db.stats()
    • db.[collection_name].stats()
    • db.[collection_name].ensureIndex({foo:1, bar:1}, {background:true})

    ... and so on.

    I hope this helps!

    这篇关于无法使用shell在heroku连接到mongohq的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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