Mongodb For Rubyists at NYC.rb. Skinandbones's rack-gridfs at master - GitHub. GridFS. GridFS is a specification for storing and retrieving files that exceed the BSON-document size limit of 16 MB. Instead of storing a file in a single document, GridFS divides the file into parts, or chunks , and stores each chunk as a separate document. By default, GridFS uses a default chunk size of 255 kB; that is, GridFS divides a file into chunks of 255 kB with the exception of the last chunk.
The last chunk is only as large as necessary. Similarly, files that are no larger than the chunk size only have a final chunk, using only as much space as needed plus some additional metadata. GridFS uses two collections to store files. When you query GridFS for a file, the driver will reassemble the chunks as needed. GridFS is useful not only for storing files that exceed 16 MB but also for storing any files for which you want access without having to load the entire file into memory.
In MongoDB, use GridFS for storing files larger than 16 MB. A MongoDB driver. Chunks stores the binary chunks. More MongoMapper Awesomeness. September was a month of craziness and for the first month in quite a while I did not post here. I promise it hurt me as much as it hurt you. In an effort to get back in the rhythm, I am going to start with an easy article. MongoMapper has been getting a lot of love lately and I thought I would mention some of the awesomeness.
Dynamic Finders Dynamic finders are so darn handy in ActiveRecord. Class User include MongoMapper::Document many :posts end class Post include MongoMapper::Document key :user_id, ObjectId key :title, String end user = User.create user.posts.create(:title => 'Foo') # would return post we just created user.posts.find_by_title('Foo') Document associations now also have all the normal Rails association methods such as build, create, find, etc. Logging The mongo ruby driver added logging support so a few days ago, I added some basic support for accessing and using that logger from within MongoMapper. Tailing the log would give you output like the following: MONGODB db.