Questions tagged [gridfs]

GridFS is a specification for storing large files in MongoDB. All of the mongodb.com supported drivers implement the GridFS spec.

GridFS is a specification for storing large files in MongoDB. MongoDB supports storing binary data directly within BSON documents, however the size is limited by the database's maximum document size (16MB as of the 1.8 production version of MongoDB; 4MB in older versions).

GridFS works by splitting large files into small "chunks", usually 256k in size.

GridFS uses two collections to store data:

  • chunks contains the binary segments of files
  • files contains metadata including the filename, content type, md5 checksum, and any optional information added by the developer

Each file saved in GridFS will have one document in the files collection and one or more documents in the chunks collection.

The GridFS collections also use a prefix (aka namespace). The default prefix is fs, so the default collection names are fs.chunks and fs.files.

GridFS collections are stored in normal MongoDB databases, and can be scaled with standard features such as replication and sharding.

Working with GridFS

All of the mongodb.org supported drivers implement the GridFS spec.

The command-line utility mongofiles can also be used to save, retrieve, list, search, and remove files in GridFS.

Related Links

1101 questions
-1
votes
1 answer

how to resize an image stream from mongo gridfs

i'm still new to node so bear with me. i have images stored in mongo gridfs. how do i resize the image stream? i'm trying to use ffmpeg. here's my method: exports.read = function (req, res) { var db = mongoose.connection.db; var id = new…
CurlyFro
  • 1,862
  • 4
  • 22
  • 39
-1
votes
1 answer

How to handle the post image and along with text contens?

I am new in mongo db, i just wanted to know that how can i handle the images along with texts in mongo db?, i have a post collection and, am inserting datas to it but i dont know how to insert both, means texts and images.
Naveenbos
  • 2,532
  • 3
  • 34
  • 60
-1
votes
2 answers

Not able store docx,pdf,csv files in GridFs

I'm have using Php, MongoDb and GridFs to store and retrieve files. It works fine for images, but I want to store files with docx, pdf, csv and etc. extensions. Here is my code: $ext = $this->getFileExt($_FILES["news_attachment"]["name"]); …
-2
votes
1 answer

http.Get() image from url and write into GridFS

I want to request an image from an url and write that image into a mongoDb GridFS database. The only working approach I got is to save the requested body to an file on OS and open it again. ... response, err :=…
tomole
  • 927
  • 3
  • 12
  • 35
-2
votes
1 answer

How to download a file from Mongo GridFS using Golang?

I am trying to write a Rest API which has a basic file upload, download. I am able to do the upload part just fine but I am having a hard time downloading file from gridfs. ANy suggestions ?
-2
votes
2 answers

How to get GridFS file by UUID in new Mongo 2.X driver

As we know, we can use ObjectId as our identifier. In my situation I have legacy code where we use GUIDs in MongoDB (UUID) as identifiers. Best Practices for UUID Data in MongoDB I have a problem with getting a file from GridFS by UUID. I use new…
adam.bielasty
  • 671
  • 9
  • 20
1 2 3
73
74