|
This is an overview of the available tools and suggested practices for using Ruby with MongoDB. Those wishing to skip to more detailed discussion should check out the Ruby Driver Tutorial, Getting started with Rails or Rails 3, and MongoDB Data Modeling and Rails. There are also a number of good external resources worth checking out. Ruby Driver
The MongoDB Ruby driver is the 10gen-supported driver for MongoDB. It's written in pure Ruby, with a recommended C extension for speed. The driver is optimized for simplicity. It can be used on its own, but it also serves as the basis for various object-mapping libraries. Installing / UpgradingThe ruby driver is hosted at Rubygems.org. Before installing the driver, make sure you're using the latest version of rubygems (currently 1.3.6): $ gem update --system Then install the gems: $ gem install mongo To stay on the bleeding edge, check out the latest source from github: $ git clone git://github.com/mongodb/mongo-ruby-driver.git
$ cd mongo-ruby-driver/
Then, install the driver from there: $ rake gem:install BSONIn versions of the Ruby driver prior to 0.20, the code for serializing to BSON existed in the mongo gem. Now, all BSON serialization is handled by the required bson gem. gem install bson For significantly improved performance, install the bson extensions gem: gem install bson_ext As long it's in Ruby's load path, bson_ext will be loaded automatically when you require bson. Note that beginning with version 0.20, the mongo_ext gem is no longer used. To learn more about the Ruby driver, see the Ruby Tutorial. Object MappersIf you need validations, associations, and other high-level data modeling functions, consider using one of the available object mappers. Many of these exist in the Ruby ecosystem; here we host a list of the most popular ones. Notable ProjectsTools for working with MongoDB in Ruby are being developed daily. A partial list can eb found in the Projects and Libraries section of our external resources page. If you're working on a project that you'd like to have included, let us know. |

PLEASE POST QUESTIONS IN THE USER GROUPS FORUM. Post non-question comments and helpful hints here.
blog comments powered by Disqus