mongodbcasbah

Some Casbah functions not working


In my project, I'm using Casbah and I reffered http://mongodb.github.io/casbah/tutorial.html tutorial. According to that I've implemented

     val mongoClient = MongoClient
     val db = mongoClient("db_name")
     val coll = db("coll_name")
     val a = MongoDBObject("hello" -> "world")

Then next step is not going to work.

coll.insert(a)

I'm using, "org.mongodb"%% "casbah" % 2.7.0-RC0

what is this issue ?


Solution

  • If running mongodb on localhost and the default port try changing:

    val mongoClient = MongoClient()
    

    So you call the apply method and return an instance of MongoClient not the object..