Learning Mongoid
上QQ阅读APP看书,第一时间看更新

Chapter 1. What's so Awesome about Mongoid?

The name MongoDB is derived from humongous. We use DataMappers to work with MongoDB. In Ruby, the most popular MongoDB mapper is Mongoid, pronounced mann-gyod. But is this the only mapper available? There also exists MongoMapper, MongoODM, and in the realm of open source there could well be many more!

So, what is so awesome about Mongoid? In a nutshell, its ability to gel with the Rails framework makes it very popular. For me, it is this adaptability to refactor and improve that makes Mongoid a very close ally of Rails.

In this chapter, we shall get a taste of the power of Mongoid. We shall see:

  • How Mongoid adheres to Rails ActiveModel and ActiveRelation syntax
  • Differences between Mongoid Version 2.x and 3.x
  • A brief introduction to Moped and Origin
  • Some differences between MongoMapper and Mongoid and their usage