Lab: Many-to-Many Relationship

In this lab, we have the next question:

Given the following Collection Relationship Diagram (CRD), identify the relationships that represent Many-to-Many relationships.

But the options for performing the response are very confusing:

For example I can’t see the relation between: items.sold_at and items.reviews.body, because in one side we have the right field that is performing the relation one to many but the other field it is just a text that is not needed for doing a direct relation.

Can any one help in this topic, it seems like the answers are wrong !

4 Likes

Hey @Carlos_Edwin_76082

This may be because there is no relationship between them? This is a possible answer. Does not mean it is right. :wink:

Hey @natac13 !

We have these possible responses:

items.title and items.reviews.body
items.sold_at and items.reviews.body
users.shipping_address.street and items.reviews.body
stores.address.street and items.description
users.credit_cards.number and items.reviews.body

I can´t see any relation that I could select that represented a many to many relationship.

Maybe I´m wrong but I can’t figurate out how to response the question.

3 Likes

That is because, like me, you are only considering direct relationships. There is also the indirect relationship where the items collection is inbetween. See if you can figure out how the relationship between those two when items is inbetween. Do remember that item.sold_at is a reference to stores, thus it represents a bunch of stores.

Edit: like me make it visually easier of what I wrote above. Look at it for a single item from items collection:

sold_at (stores) <->item from items <-> reviews.body

where ‘<->’ represents a relationship. After you figure out the individual relationships, try to figure out the whole relationship from items.sold_at and items.reviews.body.

3 Likes

Hello @Carlos_Edwin_76082,

Question is correct actually. you need to understand that “.” is representing relation between entity and attribute (Property). For example items.title is one to one relation, there can be one title per item.
so based on above explanation you have to figure out all the many to many relations (also be careful on crow’s foot notations and type of entities/ fields.

Hope this helps.

All the best!!

BR
Atul

1 Like

Although the question is correct, I don’t think it’s clear. The content of the “Many-to-Many” lecture can be revised to further explain how the dot notation can express relationships.

8 Likes

I’m agree with Opubo: introducing the dot notation without explaining it doesn’t help the comprehension. Moreover in ERD modelling the relationships is between entities always. In CRD instead you make attention at the relationships between fields of different collections. It’s quite hard to change the paradigm. I failed the test because i didn’t classify items.sold_at and items.reviews.body as M2M. My doubt is the following. How do i “read” items.sold_at? As a store or as a couple (item, store)? In the first case i agree with
a M2M categorization with body else it is a O2M for me ( a product sold in a store can have more rewiews and a rewiew is about one product sold in one store ).

2 Likes

I believe the part about sold_at [0, 200] and reviews[0, 1000] would be what shows that both of these are Many fields from 0 to 200 and 0 to 1000

I’am agree, it’s very very confusing …

3 Likes

I agree with all of the above complaints, this was a very confusing and misleading exercise. Coming from an RDBMS background and ER diagrams, I expected the many end of the crows feet to point to the field that is being linked (joined). Even if those don’t match it seems like the arrays, as natac13 pointed out, should represent the many fields : sold_at containing a list of store ids, and the item.reviews.body.user_name containing an entry for each user review. The video should definitely be edited to explain the indirect (and convoluted) relationship paths that the dot notation represents.

5 Likes

about “items.sold_at and items.reviews.body”

Try not to interpret
items.sold_at as strict array of integer ie.
[2,45,23,78,34]
but rather try to expand it. It’s array of references so:
[
{_id: 2, name: “store A”},
{_id: 45, name: “store C”},
{_id: 23, name: “warehouse Z”}
{_id: 78, name: “store D”}
{_id: 34, name: “warehouse A”}
]

Hmmm @gezz, to me I would interpret sold_at as strictly array of Integers as depicted in the schema:
image
It’s only reviews that is an array of dictionaries.

I think there is a bug in this question.
Can, please, somebody from the Staff confirm that it has right answer?
Because I think that the correct answer is when no options are chosen, but it is impossible to submit this answer, because the Submit button is disabled.

2 Likes

I also have a question: Can it be M-2-M between users.cc.number and items.reviews.body while the type of field: users.name is and of field: items.reviews.user_name is .

I can’t find out in the tutor clips it is possible to have such a relationship, can somebody explain to me?

@Yevgeni_12735 there are definitely answers to choose from.
@TuanD Unfortunately I’m not at liberty to give you the answer for this lab.

The main points to pay attention to are:

  • the relationship, i.e. the crow’s foot
  • the relationship, i.e. read it from left to right and also read it from right to left
  • think about about the underlying relationship
  • is the field an array or not

Consider those points and you’ll be fine. Good luck! :slight_smile:

Unfortunately I got this question wrong, as I dropped out the option I thought it was right yet rethink that is wrong. That is why I posted the above unsatisfactory about the clips contents. Even I read in MongoDB document sites about n-to-n relationship I can’t see any relationship as embedded documents or reference with joining fields in different types. Anyway thanks for your quick feedback.

Yes, it was mentioned in another thread the dot relationship should have been explained and the Curriculum Managers took it on board (I think).

1 Like

No worry 007_jb, I will try to simulate fake data to the database of version 4.2 to see whether it works or not, I also think of the way to convert the type of to before joining those fields, though it will skip some null value during conversion.

agree to this response

I agree with the previous complaints.
I even have trouble understanding the detailed answer especially for # 3 users.shipping_address.street and items.reviews.body.
For #2 items.sold_at and items.reviews.body is not obvious when looking at the diagram.
Frustrating :frowning_face: