Hi team,
I am working with scala 2.10 and casbah gridfs 2.5.0.
I would like to get an image from Mongodb then transform to inputStream type.
My code is:
"
// Imports just the Query DSL along with Commons and its dependencies
import com.mongodb.casbah.gridfs.GridFSDBFile
import com.mongodb.casbah.gridfs._
import com.mongodb.casbah.query.Imports._
//Import File Lib
import java.io.File
import java.io.FileInputStream
val mongoDBConnection = MongoConnection()("myTestDB")
val gridFS = GridFS(mongoDBConnection)
// store Files
val imageFile = new File("D:/test2.jp2")
val fileInputStream=new FileInputStream(imageFile)
val gfsFile=gridFS.createFile(fileInputStream)
gfsFile.filename="test2.jp2"
gfsFile.save
// get an Image
val files = gridFS.findOne(new ObjectId("56d84ca6022b8bddf7a906b8")) // this is ObjectID of the above file "test2.jp2"
val inputStream = files.inputStream.get()
....
"
I get an error "value inputStream is not a member of Option[com.mongodb.casbah.gridfs.GridFSDBFile]"
Anybody can tell me what happened?
Best regards.