Chapter 2, Lab: Many-to-Many Relationship

One of the many to many relationships in this diagram is

items.sold_at and items.reviews.body.

The reason was

From an items point of view there are possibly Many values of sold_at and Many values of reviews.body .

So going from one of those two fields to another, we will traverse a Many-to-One relationship, then a One-to-Many relationship, making the whole relationship a Many-to-Many relationship.

Another way to look at it is to understand that a given review will be indirectly linked to all the stores that sell the product and that a given store has multiple reviews pertaining to the products it sells.

I don’t understand the “we will traverse a Many-to-One relationship, then a One-to-Many relationship”

I believe the “Many-to-One” relationship is referring to the relationship between the store ids in the items.sold_at array and the items entities but isn’t that a many-to-many relationship? Any given store can have multiple items and any given item can be sold at multiple stores right?

I think that when reading the collection relationship diagram, we have to consider the relationships of a single item rather than the items collection as a whole.
Each document within the items collection represents what we want to know about a single item.
Where a particular item is sold is represented by an array of store ids held in the items.sold_at field. This a one to many relationship, so we go from the many sold_at to the one item.
Reviews of an item are represented in the items collection in the reviews field which is an array of documents. This is a one to many relationship, so we go from the one item to the many reviews.