0

I am new to Scala and trying to use Casbah toolkit for MongoDb. Casbah tutorial says:

"...This should allow a more fluid Syntax to working with Mongo. The DB object also provides an apply() for getting Collections so you can freely chain them:"

scala> val mongoColl = mongoClient("casbah_test")("test_data")
mongoColl: com.mongodb.casbah.MongoCollection = MongoCollection()

Where can I read about Scala constructs such as mongoClient("casbah_test")("test_data") ? Thanks!

Anton Ashanin
  • 1,817
  • 5
  • 30
  • 43
  • 1
    possible duplicate of [What's the difference between multiple parameters lists and multiple parameters per list in Scala?](http://stackoverflow.com/questions/6803211/whats-the-difference-between-multiple-parameters-lists-and-multiple-parameters) – om-nom-nom Mar 21 '13 at 12:19

1 Answers1

0

I'm sorry its not a great story at the moment and the learning curve is steep. The documentation for casbah is due for an upheaval see SCALA-63 and at the moment it expects you have a working knowledge of how to use mongodb before being able to get to grips with using it in scala.

For the time being I think the fastest way to success is to follow the main getting started guide and take the lessons from the shell into how to use Casbah.

If you are more motivated to dive into the code, you can use the query integration spec tests for an idea how to use the fluid api.

If that doesn't disuade you and you want to support an open source project I'd happily take pull requests on improving the documentation - ping me on the user group.

Ross
  • 17,861
  • 2
  • 55
  • 73
  • So far I had several projects where I used MongoDB Java drive to my heart content )) Java driver is really easy to use. I am learning Scala and it was the first time in Casbah tutorial where I came across constructs like "mongoClient("casbah_test")("test_data")" So I am trying to find where to read about these (multiple parameter lists?) constructs. – Anton Ashanin Mar 21 '13 at 17:41
  • Ah well you really are just chaining methods and calling ("test_data") on the result of mongoClient("casbah_test") - so initially you have a connection and then you call the apply method on the connection with ("test_data") returning a database, chain it again you get a collection. – Ross Mar 22 '13 at 11:14
  • So this is similar to Java fluids, I use it all the time. Scala syntax confused me though (so I thought it is some other Scala-specific concept). Speaking about fluids instead of "mongoClient("casbah_test")("test_data")" I would expect to see a dot inside: "mongoClient("casbah_test").("test_data")" Which is in fact "(mongoClient("casbah_test")).apply("test_data")" correct? – Anton Ashanin Mar 22 '13 at 13:29