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

displaying images from mongodb gridfs using spring data

I am new to this area, I have added a number of images to gridfs. Now i want to display all these images on html page. I have retrieved the images from mongodb using the following code. Query query = new…
Shahzeb Khan
  • 3,582
  • 8
  • 45
  • 79
0
votes
1 answer

Download returns a corrupted document (bottle + pymongo)?

I have a basic web form at '/add' that takes user input and uploads to a mongodb: PYTHON: @bottle.route('/add') def add_page(): return bottle.template('files_test/add') @bottle.route('/upload', method='POST') def do_upload(): data =…
Jeff
  • 4,285
  • 15
  • 63
  • 115
0
votes
1 answer

Determine image dimensions for image stored in GridFS from meteor

I'm trying to determine the width of an image stored in GridFS on meteor so that I can re-size a modal dialog. I have a helper for the template Template.projectImageModalInner.image = function() { var imageId = Session.get("selectedImageId"); …
Peter Nunn
  • 2,110
  • 3
  • 29
  • 44
0
votes
2 answers

Link pdf with collection/database in Mongodb

I am new to MongoDB. I have following data. Empid, Name, Salary, Resume (Resume is in PDF Format). Now I am able to insert id, name and salary using mongo shell as following. db.test.insert({empid:100,Name:'Gaurav',Salary:1000}); I am using…
Gaurav_Bhide
  • 105
  • 1
  • 7
0
votes
1 answer

Saving a base 64 encoded image in MongoDB GridFS

I have a web service that takes the content of a canvas tag and saves it into a MongoDB GridFS store. The code below works, however it requires saving the image to disk before sending it to MongoDB. Using postBody As Stream =…
Chad Levy
  • 10,032
  • 7
  • 41
  • 69
0
votes
1 answer

Suitable NoSQL database to implemet download server

I need a NoSQL database to store our files with following specification: easy Clustring Distributed Automatic failover easily scalable Fast I have searched and find some solution like "MongoDB GridFS" or "Riak" but i think i have to research more…
Saeed Zarinfam
  • 9,818
  • 7
  • 59
  • 72
0
votes
1 answer

Use GridFS on the local disk with C++

I'm looking for a solution that let's me store some nested filestructure (directories, files) in a single file. I thought about simple archives like tarballs, but due to many operations it's not appropriate. Than I thought about JSON and store…
Chris Pillen
  • 810
  • 8
  • 27
0
votes
2 answers

django-mongodb-engine Where is GridFSField Model Field

I'm using django-mongodb-engine for a project I'm working on and the documentation advises users to use the GridFS storage system for storing blobs as opposed to using the filesystem method. Obviously, this is one reason why we choose to use mongodb…
James
  • 2,488
  • 2
  • 28
  • 45
0
votes
2 answers

Storing and Retrieving image from the MongoDB (GridFs) and displaying in Html using vb.net webservice

I am trying to store and retrieve images from the MongoDB (Gridfs) and displaying the image using HTML. I stored the image and got the image id, on passing the id into the HTML page using Ajax it takes the image id but image is not getting displayed…
pavan
  • 470
  • 3
  • 11
  • 25
0
votes
0 answers

Mongo DB and CodeIgniters

i want to build a system for storing documents (mostly words), it's a good idea to use MongoDB with GridFS? i was planing to use mysql for the users and relations among the documents and only use mongo for files..
fuentesLC
  • 9
  • 1
0
votes
0 answers

mongodb copydb command copy gridfs db get 'BSONObj size: 0 (0x00000000) is invalid' error

i want copy a gridfs(db) from one machine to other machine.i'm use a copydb command. > db.runCommand({copydb:1,fromhost:"192.168.1.90",fromdb:"fs_photos",todb:"fs_photos"}) { "errmsg" : "exception: BSONObj size: -791766910 (0x8298CED0) is…
zhengchun
  • 1,261
  • 13
  • 19
0
votes
1 answer

How to delete an entire gridfs (with the Ruby driver)?

I'm considering using multiple gridfs kind of like folders. The idea being that then deletion of folders is easy. Just delete the file system. I've just one problem. I don't see any way of deleting them? If deleting them means I have to loop through…
Timo
  • 3,335
  • 30
  • 25
0
votes
2 answers

Monogid4 Gridfs connection failure

I'm working on Rails4, Mongoid4 and Gridfs. I;m not able to connect gridfs filesystem class GridfsController < ApplicationController def serve gridfs_path = env["PATH_INFO"].gsub("/uploads/", "") begin gridfs_file =…
sukhendar
  • 63
  • 1
  • 6
0
votes
2 answers

Grails using gridfs of mongo - plugins not matching

My application needs to use mongodb for normal data storage and also to keep pretty large files. Hence I started with plugins for mongodb (for normal data storage) and gridfs (for large files). I am using grails 2.3.4 and trying to figure out what…
Gsb
  • 3
  • 3
0
votes
1 answer

Image not display serving image using GridFS in Node.js

I am taking in a png file from AFNetworking saving it to GridFS and then I would like to be able to retrive it at some point. Out of curiousity I logged the image before it entered GridFS and it looks like.. <89504e47 0d0a1a0a 0000000d 49484452…
Michael Giba
  • 118
  • 4