I am using this code https://github.com/alvinj/ScalaCasbahConnections/blob/master/src/main/scala/casbahtests/MongoFactory.scala
object MongoFactory {
private val SERVER = "localhost"
private val PORT = 27017
private val DATABASE = "finance"
private val COLLECTION = "stocks"
val connection = MongoConnection(SERVER)
val collection = connection(DATABASE)(COLLECTION)
}
but here in this code COLLECTION val has "stocks" value means it has only one value what if i want to use different values of collection name how can i modify this code to support different collection names ,please help
I guess it must work:
def collection(name : String) = connection(DATABASE)(name)