0

I have the following environment variable on Heroku :

MONGOHQ_URL: mongodb://heroku:password%40mongohq%2Estaff%2Ecom:10056/app6186345

Originally the error was :

Database name cannot contain '.'

I escaped '.' and '@'and I still have the same result, a connection failed but with the message :

[Error: failed to connect to [heroku:27017]]

What am I doing wrong?

When I checked the documentation about mongoHQ, nothing is said about escaping caracters or something equivalent.

7
  • I don't encode my connection and it works for me. Do you have a . or @ in your password by chance? Also, it's probably a copy/paste, but that url for mongohq is backwards, can you verify that?
    – blu
    Jul 30, 2012 at 21:18
  • No @ or . in my password.. this url is backward?
    – Jeremy D
    Jul 30, 2012 at 21:19
  • Also, if you go to your database in mongohq and click on the Database Info tab there are two samples on how to connect. Does logging in with the mongo shell work?
    – blu
    Jul 30, 2012 at 21:19
  • it should be "@staff.mongohq.com" not "@mongohq.staff.com"
    – blu
    Jul 30, 2012 at 21:21
  • It works using the mongo shell...
    – Jeremy D
    Jul 30, 2012 at 21:21

1 Answer 1

2

It looks like you may have reversed the subdomain and domain name for mongohq on accident.

It should be @staff.mongohq.com instead of @mongohq.staff.com

1
  • Yes, I agree. That is the issue that you are seeing. I am not sure why it would be working via mongoshell. Can you share output? Jul 30, 2012 at 22:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.