Understand how a relationship between two Collections links data in those Collections.
A Collection relationship links two Collections by designating one Collection as a parent Collection, the other as a child Collection, and defining data keys or columns linking both Collections. The Collection from which this relationship is created is automatically designated as the parent Collection. The relationship is a one-to-many relationship such that a record in the parent Collection can have multiple matching records in the child Collection.
Consider the following example of two Collections at a college:
Professors: One Collection named Professors contains record information about each professor, such as the name, department of study, email address, and classes each professor teaches.
Available Courses: Another Collection named Available Courses contains record information about all courses offered at that college, such as the name, the professor teaching that course, and its area of study.
The common data between these Collection records is the name of the course. Use this common data to establish a one-to-many relationship from one Collection to the other. To establish a relationship between the available courses and which classes are available of each course during a semester, the Available Courses Collection is the parent Collection. The Professors Collection is the child Collection that contains multiple records of each class from the Available Courses Collection, thereby establishing the one-to-many relationship between these Collections. Students use this example to register for classes in available courses.
Inversely, the Professors Collection can be the parent Collection, with the Available Courses Collection being the child Collection: students can view all classes that a specific professor teaches regardless of the courses that professor teaches.