Chapter 5. Mongoid Queries
In this chapter, we will learn everything about querying documents. We will see how to fire queries on various data types, embedded documents, and indexed queries. We will learn about criteria, lazy evaluation, and eager loading! We will also take a quick look at aggregations and MapReduce.
Mongoid querying DSL (domain-specific language or grammar) has been abstracted into a gem called Origin. This gem provides ActiveRelation styles to Mongoid queries. Origin can be used on its own, even without Mongoid and the main reason for this was to write a generic querying DSL that can be used independently.