1

I am working on Eclipse with a small scala/scalatra application.. at first I worked with mongodb installed on eclipse (locally) my application is running and everything is good but when I wanted to deploy my application on heroku I found http 503 error.

I think the problem is in my database, is what I need to change my connection with my base mongolab https://mongolab.com or should I add mongolab at heroku.

for connection mongodb I did:

    val mongo = MongoConnection()
val coll = mongo("db_test")("tache2")

How can I change my code so I can have it connected to my account mongolab??

yotta
  • 35
  • 4

1 Answers1

0

You should create your uri like this:

val uri = MongoURI(s"mongodb://${username}:${password}@${host}:${port}/${dbname}")

def db: casbah.MongoDB = MongoConnection(uri)(dbname)

Note, this is using Casbah API.

Marcin Cylke
  • 2,100
  • 2
  • 21
  • 40