I'm new to mongodb and scala and I'm currently using Casbah as my driver to interface between the two on the play framework. I can't figure out what datatype is returned by collection.find(). I'm trying to create a function that returns the result of collection.find() and I need to specify the return type.
Documentation and my IDE are all contradicting each other. Example:
val collection = MongoClient("localhost", 27017)("databaseName")("collectionName")
I believe collection above is MongoCollection. But what datatype is returned by
collection.find()
I'm trying to write the following:
def getAllDocumentsInCollection(collectionName:String): DBCursor = {
val collection = getCollection(collectionName)
collection.find()
}
The compiler yells above saying the return type is collection.CursoryType but I have no idea how to find collection.CursorType. import collection.CursorType doesn't work.
Documentation from the Book "Scala for Data science" says yes collection.find() returns collection.CursoryType but that doesn't compile for the reasons I've stated above and documentation from Casbah say its of type DBCursor but that doesn't compile because my IDE says its of type collection.CursorType. I'm going in circles here...
Casbah Doc http://api.mongodb.com/scala/casbah/2.1.2/scaladoc/com/mongodb/casbah/MongoCollection.html
Scala Version: 2.11.17
Casbah Version: 3.1.1
I'm running play and scala through activator.
What version of scala do you use? Seems, you use so old version of casbah, it's better to update it if you can. I can't even find casbash in maven repository