To demonstrate how MongoDB and RDBMS can work together, we are going to design the schema of the database for a fictional company named Acme Corp (the fans of the Looney Tunes cartoon series might be familiar with their products!). For the sake of simplicity, we will limit the tables of the database to three:
products: This table lists all the products manufactured by Acme Corp.
customers: This table contains a list of all the individuals who purchased Acme Corp products.
sales: This table contains a record of each sales transaction of Acme Corp products.
The following diagram shows the schema diagram of the database:
As shown in the diagram, the product_id field of sales is a foreign key referencing the primary key of products, and the customer_id references the primary key of customers.