2

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.

Alexandre
  • 13,030
  • 35
  • 114
  • 173

2 Answers2

7

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!

Jason McCay
  • 3,295
  • 1
  • 13
  • 8
2

You should be able to show collections, but show dbs requires admin privileges.

jared
  • 5,369
  • 2
  • 21
  • 24