Description
This is the repo with the full examples: [link]
# Relational vs Document-Oriented Database for Software Architecture
What I go through in here is:
1. Super quick refresher of what these two are
2. Key differences
3. Strengths and weaknesses
4. System design examples (+ Spring Java code)
5. Brief history
In the examples, I choose a relational DB in the first, and a document-oriented DB in the other. The focus is on _why_ did I make that choice. I also provide some example code for both.
In the strengths and weaknesses part, I discuss both what _used to be a strength/weakness_ and how it looks nowadays.
## Super short summary
The two most common types of DBs are:
- **Relational database (RDB)**: PostgreSQL, MySQL, MSSQL, Oracle DB, ...
- **Document-oriented database (document store):** MongoDB, DynamoDB, CouchDB...
### RDB
The key idea is: **fit the data into a big table**. The columns are _properties_ and the rows are the _values_. By doing this, we have our data in a very structured way. So we have much power for querying the data (using SQL). That is, we can do all sorts of filters, joints etc. The _way_ we arrange the data into the table is called the _database schema_.
#### Example table
```
+----+---------+---------------------+-----+
| ID | Name | Email | Age |
+----+---------+---------------------+-----+
| 1 | Alice | [email] | 30 |
| 2 | Bob | [email] | 25 |
| 3 | Charlie | [email] | 28 |
+----+---------+---------------------+-----+
```
A database can have many tables.
### Document stores
The key idea is: **just store the data as it is**. Suppose we have an object. We just convert it to a JSON and store it as it is. We call this data a _document_. It's not limited to JSON though, it can also be BSON (binary JSON) or XML for example.
#### Example document
```JSON
{
"user_id": 123,
"name": "Alice",
"email": "alice[handle]
Employer contacts (email/phone/telegram) are hidden from the public preview —
send your CV, and we will connect you directly.