public
Description: Awesome gem for modeling your domain and storing it in mongo
Home | Edit | New

Home

MongoMapper

Already know why MongoMapper rocks? Want to learn how to use MongoMapper?

Take a look at the QuickStart.

What is MongoDB?

MongoDB is a high-performance, open source, schema-free document-oriented database. It is an excellent combination of the speed of a key-value store and the deep features of an RDBMS. If you’d like to learn more about why MongoDB is awesome, take a look at their homepage: www.MongoDB.org.

The real value of MongoDB shines in the fact that records, arrays, and other objects can all be stored inside of a record. By deeply nesting data inside of a record, you can avoid expensive joins and other complex issues from typical relational databases.

What is MongoMapper?

MongoMapper is a Ruby wrapper library which aims to make using MongoDB much easier and friendlier than the default Ruby driver provided by XGen. When it makes sense to do so, MongoMapper tries to stick closely with the familiar syntax of ActiveRecord.

Because of the way MongoDB stores data, there are two key concepts when working with MongoMapper: the Document?, and the EmbeddedDocument?.

The Document is essentially a record with fields, just as you’d expect.

An Embedded Document is exactly like a Document, except that it is injected into a Document and still retains all of its information.

Because of the way MongoMapper works, all of this is transparent to you. With MongoMapper, when you retrieve a record with an embedded document attached to it, the embedded document’s information is retrieved along with it, which is where MongoMapper truly shines. By embedding when it makes sense to do so, you are able to retrieve all of the typical join information in one speedy query.

To learn more about how to use MongoMapper, take a look at the QuickStart.

Last edited by duien, Tue Aug 04 15:09:42 -0700 2009
Home | Edit | New
Versions: