Chapter 4. Mongoid Relations
Now that we have seen how documents are stored, let's see how documents are related to each other. Mongoid tries to be as close to ActiveRecord relations as possible. In this chapter, we will see the basic relations that exist between documents:
One-to-One (1-1) relation
One-to-Many (1-N) relation
Many-to-Many (N-N) relation
Polymorphic relation
In addition to this, we will also learn about relations with embedded documents and how they are managed.