From the course: Databases for Node.js Developers

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Review the database design

Review the database design

From the course: Databases for Node.js Developers

Start my 1-month free trial

Review the database design

- [Instructor] Before we create the data structures for our order management, let's review the design behind it first. For that, I created an entity relationship diagram, short ERD. So it shows the entities that will later be in the database. A order is represented first by an order ID, that's just one unique ID. Then we want to store the user ID. That's the ID of the user in MongoDB, the email address, and an order should also have a status like shipped. You might now wonder why we even store the email address as we already store the user ID. This is because the user might be deleted from MongoDB at some point, and then we would have no way to reach out to the user again. Of course, for a real order management you would also want to store the address of the user. So, each order also consists of items to be ordered. And those items will now be stored in a separate table called OrderItem. And this OrderItem is connected to…

Contents