1

I'm trying to find a file in gridFS via the md5 hash, but don't get it to work.

My app is a Play application, therefore I use play salat plugin. This is what I'm doing:

val Images = gridFS("Images")
val image = new File("<some path>/filename.png")
val dbImage = Images.createFile(image)
dbImage.save()

val md5 = dbImage.md5

// now check md5
val result = Images.findOne(MongoDBObject("md5" -> md5)

The result is None in my case, but I expect it to be the file previously saved. I also tried:

val result = Images.findOne(new BasicDBObject("md5", md5))

The file is saved to the db, when I check via cli, it's there. How can I get this file using the md5 hash?

schub
  • 912
  • 1
  • 8
  • 26

0 Answers0