Skip to content

Commit 75c987b

Browse files
committed
Added some explanation to relational and MongoDB schemas
1 parent 4f476bb commit 75c987b

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

docs/30-schema-in-postgresql.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import Screenshot from "@site/src/components/Screenshot";
22

33
# 📘 Schema in PostgreSQL
44

5-
The following screenshot shows an Entity-Relationship diagram of the relational database we wish to migrate.
5+
The following screenshot shows an Entity-Relationship diagram of the relational database we wish to migrate. This is a Library management app, that stores information about Books, where a Book can have many Authors, an Author can write many books, users can borrow books and leave reviews.
6+
7+
This is the sample schema we use during our [Developer Days's Intro Lab](https://mongodb-developer.github.io/intro-lab/docs/importing-data/intro).
68

79
<Screenshot url="https://www.mongodb.com/products/tools/relational-migrator" src="img/30-image-001.png" alt="Screenshot of the connect modal" />

docs/40-desired-schema-mongodb.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,8 @@ that data that is frequently accessed together is stored together by using embed
99
The following screenshot shows the MongoDB schema we will be creating in this lab.
1010

1111
<Screenshot url="https://www.mongodb.com/products/tools/relational-migrator" src="img/40-image-001.png" alt="Screenshot of the connect modal" />
12+
13+
A few key points:
14+
- books will contain an array of authors with author id and name for fast retrieval. This is using the [Extended Reference Pattern](https://www.mongodb.com/blog/post/building-with-patterns-the-extended-reference-pattern) to reference a separate Collection (Authors) but having in books enough information aubout the author.
15+
- reviews are not included in the books collection as they can grow and become an [unbounded array](https://www.mongodb.com/developer/products/mongodb/schema-design-anti-pattern-massive-arrays/), an atipattern in Schema Design.
16+
- an author can have several aliases, we just store those strings in an array.

0 commit comments

Comments
 (0)