mongodb-haskell/mongodb

Deploying to heroku

Closed this issue · 3 comments

I'm trying to deploy a web app using this library to heroku, but the problem is I can't make the connection to mongo because of the url format.

Heroku provides urls to connect to in something like this format:

mongodb://user:pass@host:port/path

So a randomised version of that is:

mongodb://herokudwd0k6:dwadokwdoakw1697qcfhjk11e9@d452.mlab.com:23452/heroku_1j2xk6

But this format is not compatible with host or readHostPort since I just get a "server: getAddrInfo: does not exist (Name or service not known)" error with host or a format error with readHostPort. Do you know if there's a way I can connect to the database via a url like the above?

You need to provide "connect" function with your host and port from this urls.
Then user and password go to "auth" function from Query module.
Path is the name of you database. It should go to "access" function.

I strongly recommend gitter (https://gitter.im/mongodb-haskell/mongodb) for this kind of questions. This channel is specifically created for mongodb discussion.

I assume we can close the issue.