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
0
votes
1 answer

Storing files into MongoDB as using Flask, pymongo and GridFS?

I have a very specific question. So i'm writing an app that takes in an integer and a file in flask and stores them as a key value pair in a MongoDB. I was writing the mongo part with the help of a friend that works for mongo and that part of the…
davidawad
  • 1,023
  • 11
  • 20
0
votes
1 answer

download files using Yii2 gridFS

I want to download files from gridfs using YII2. I am new to Yii I have used this code class classname extends \path\controller{ $connection = new \yii\mongodb\Connection([ 'dsn' => 'mongodb://localhost:27017/files', ]); …
Ashwin
  • 455
  • 3
  • 7
  • 15
0
votes
0 answers

How to retrieve file content(.txt , .pdf etc .,) from mongodb gridfs using carrierwave , mongoid grid fs?

I am getting issues with gridfs file system when try to retrieve files from gridfs, I could able to store files(text,pdf) using carrierwave mongoid gridfs and unable to get the data from the mongodb , Can anyone please help me I uploaded sample text…
0
votes
2 answers

MongoDb gridfs method

i have two doubts .they are 1.How to provide object id when storing file using gridfs the command that i use is mongo file mongofiles -dbpath gridfs put hi.txt 2.Can we view the content of file which was stored in mongodb using gridfs method I…
The6thSense
  • 8,103
  • 8
  • 31
  • 65
0
votes
1 answer

GridFS Node.JS Native Driver - How to get ignore ContentType?

I'm interacting with MongoDB with several drivers including PyMongo and Node.js Native MongoDB driver. What I noticed is that when I do fs.put for GridFS storage from PyMongo it only sets few fields including UploadDate, but when I do fs.put for…
dimon222
  • 162
  • 2
  • 20
0
votes
1 answer

mongo db gridfs throws null pointer exception in play framework 2.3.x java

I am following this link: mongoDBgridfs. I am using exact code .but while executing blob method it gives null pointer exception. At this line newUser.photo = new Blob(file, type); but the image is present, I am sure that picture path is…
Vish Bansal
  • 28
  • 1
  • 8
0
votes
1 answer

Gridfs cannot find file in different buckets

I have added a file into the collection my_collections. I am not able check if the file was saved. With the default bucket (fs.chunk and fs.files) the code below works properly db.my_collection.files.find() { "_id" :…
AmeyChavan
  • 362
  • 1
  • 2
  • 14
0
votes
1 answer

What's the easiest way to store a large object in Meteor using GridFS?

I'm trying to backup a Lunr Index to Mongo (daily), and because it's running around 13MB, I'm triggering MongoError: document is larger than capped size errors. I'd like to use GridFS to get around the problem, but I'm having a heck of a time…
webeye
  • 5
  • 2
0
votes
1 answer

error while loading mp3 files to mongodb

I want to add one mp3 file into mongodb database using gridfs.my mp3 file is located on my desktop.So i m using the command i.e " C:\mongodb\bin\mongofiles.exe -d gridfs put C:\Users\27390\Desktop\Kalimba.mp3" but its showing the following error i.e…
manishankar
  • 35
  • 1
  • 5
0
votes
0 answers

Relationship between Sharding and GridFS in MongoDB?

I was reading the MongoDB documentation, it lists Sharding and GridFS as its two key features. I am wondering what the relationship between these two concept?
Blake
  • 7,367
  • 19
  • 54
  • 80
0
votes
3 answers

Ruby mongoDB and large documents

I have a populated mongoDB. Now I need to add huge amounts of additional data to my documents (log file data). This data exceeds the BSON size limit. Document too large: This BSON document is limited to 16777216 bytes. (BSON::InvalidDocument) A…
fex
  • 197
  • 1
  • 13
0
votes
1 answer

Usung ASP.NET MongoDB.Driver and I can't save ContextType

From the course: Using MongoDB with ASP.NET MVC Demo: Displaying Rental Images ^In case you have Pluralsight At this point in the course we had attached the images to a Rental document, next we use some razor and a GetImage Action to display an…
0
votes
1 answer

Image streamed from Mongo's Gridfs not displayed in browser

I am posting this issue here, I have been reading many related posts, but any of them helped me in making it work. The idea is pretty easy: I have a MEAN-based application in which is possible to upload an image to GridFS - WITHOUT storing it…
0
votes
1 answer

NodeJS acess fs.chunks from fs.files

I am using GridFS to retrive image from mongoDB: I do: // Connect to the db MongoClient.connect("mongodb://10.8.2.232/mydb", function(err, db) { if(err) return console.dir(err); var fileId =…
Carlos
  • 79
  • 1
  • 4
  • 16
0
votes
1 answer

nginx configuration file throws error while gridfs configure?

I have installed nginx-gridfs and followed https://github.com/mdirolf/nginx-gridfs. Nginx installed successfully. In nginx.conf file I have specified as below: server{ location /gridfs/ { gridfs my_app; } } It throws an error gridfs is…
Durga Prasad
  • 935
  • 2
  • 11
  • 18