The ERD is confusing to me as is the question which made it difficult to answer. At a conceptual level, you have 3 documents (Stores, Items & users).
- Without any knowledge of Stores and Items but understanding crows feet notation, there is a many to many relationship between Stores and items. What are the linkages?
- users and items have a 1 to 0,1 or more relationship. Again, what are the linkages?
Relational databases use a convention of singular nouns such as store, user, item, person, etc. Does MongoDb have any conventions like this?
Couple of things there…
Firstly, Entity Relationship Diagrams come in many forms and I don’t believe there really is any “correct” formal representation for them. A wikipedia search for “entity relationship diagram” points to an article called “Entity Relationship Model” which discusses and lists a lot of possibilities and options.
One of those possibilities/options is connecting tables together diagrammatically without necessarily indicating which fields that make the linkages. This is perfectly acceptable ERD notation in some cases. This diagram is one of those cases.
As I understood it, for the purposes of the question we don’t need to know the fields that make the links/relationships, just the tables. I think there’s an inherent assumption that there are standard primary (unique) and secondary keys that aren’t necessary listed in the fields list. The crows feet indeed indicate the many/one-ness of each side of the relationship, which is enough information to be able to answer the question at least.
Secondly, an ERD describes the relationships between … well … entities, which in traditional databases are tables. MongoDB and some other NoSQL databases use documents instead of tables. In basic terms, they’re similar, except documents have a few flexibilities that tables don’t have, one of which is the ability to embed the documents (tables) within others. In that diagram, for example, Reviews would normally be a separate table in an SQL database but is just an embedded table/document within the Users document in MongoDB.
So traditional ERD notation has to be adapted - or perhaps used with a little creative license - if we’re going to use it in a NoSQL context.
Considering all of that…
Your understanding of the relationship between Stores and Items is correct. Further, as I’m sure you know, usually a many to many relationship is made via a table in between, that in this case isn’t shown in that diagram. It’s for us to infer that it’s there, or it’s possible that it’s handled some other way. HOW that relationship is implemented is not information we need for purposes of the question.
Regarding Users and Items - and I think this might be the big reveal for you: If you look a little closer, you can hopefully see that the line goes in fact from Users to Reviews, not Users to Items. This makes practical sense since a User would post a Review for an Item, whereas I’m not sure I can see any direct relationship between Users and Items that makes any practical sense. So, the diagram doesn’t indicate any direct relationship between Users and Items - except indirectly through Reviews. The line indicates a relationship between Users and Reviews, and Reviews is an embedded “table” within Users. The “[0,1000]” notation next to “Reviews” is described earlier in the course and indicates that there’s a one to many relationship between Items and Reviews. This therefore makes a many to many relationship between Users and Items.
I’d argue that the singular noun convention isn’t a convention specifically for relational databases, more it’s a convention for programming with any kind of entities in general - databases or otherwise. That said it’s one of any number of conventions in any of those contexts, which include SQL databases, MongoDB and other NoSQL Databases, and traditional OOP programming. In each of those one might use the singular nouns convention, or one might not. At least that’s been my experience the last 20 years or so.
Hope this helps…!