Skip to content

GridFSDAO

Info

GridFSDAO adds MongoDB GridFS support.

It provides easy upload, download and metadata handling.

Sometimes also normal collections can be helpful for storing data.

Official_MongoDB_Documentation

Furthermore, if your files are all smaller than the 16 MB BSON Document Size limit, consider storing each file in a single document instead of using GridFS. You may use the BinData data type to store the binary data. See your drivers documentation for details on using BinData.Furthermore, if your files are all smaller than the 16 MB BSON Document Size limit, consider storing each file in a single document instead of using GridFS. You may use the BinData data type to store the binary data. See your drivers documentation for details on using BinData.

Usage

A MongoDatabase and a bucket name is needed.

Create DAO

scala

  /**
  * use bucket name fs
  */
  object ImageFilesDAO extends GridFSDAO(database)

  /**
  * use bucket name images
  */
  object ImageFilesDAO extends GridFSDAO(database, "images")

Released under the Apache License 2.0.