RDMS vs. NoSQL modeling

Learn how to model Cosmos DB documents based on the use cases.

Introduction

Modeling is a crucial part of the development of Cosmos DB. The lack of relationships and the concept of partitions force us to spend a reasonable amount of time on our document structures. This lesson will use a movie theatre ticketing system to understand the differences between the two database types.

Imagine a SaaSSoftware as a service (SaaS) allows users to connect to and use cloud-based apps over the Internet. that multiple movie theatres use to let customers buy tickets and let management track earnings.

The system is pretty simple:

  • A user can buy tickets.

  • A user can see the list of purchased tickets.

  • A manager can see the number of tickets sold for each movie.

  • A movie has multiple shows.

Entity-relationship modeling

When working with relational databases, we usually start defining the entities involved and how they relate to each other. After an initial draft, tables are normalized to reduce data redundancy and improve integrity.

The result would be something similar to the following:

  • A user has multiple tickets.

  • A movie has multiple shows.

  • A ticket has both a user and a show.

Get hands-on with 1400+ tech skills courses.