Getting Started with MongoDB and Ruby

Install MongoDB
brew update
brew install mongodb
port install mongodb
mongod
mongod is the primary daemon process for the MongoDB system. It handles data requests, manages data format, and performs background management operations. [MongoDB.org] Install the gems:
gem update --system
gem install mongo
gem install bson
gem install bson_ext
source: mongodb.org Ruby:
require 'rubygems'  # not necessary for Ruby 1.9
require 'mongo'

include Mongo # Include Mongo so that the Mongo classes are available without having to specify the Mongo namespace.

mongo_client = MongoClient.new("localhost", 27017) # A MongoClient instance represents a connection to MongoDB

Leave a Reply

Your email address will not be published. Required fields are marked *