NoSQL and Firebase Data Modeling

Intro NoSQL Data Modeling

Data Modeling of a Non-Relational Database (NoSQL) is a big challenge for any developer. Because working with data from NoSQL can be something complex and out of what we are used to. But there's no more running away.

Non-relational databases like MongoDB or Firebase are growing more and more, as they bring a lot of performance and scalability to your project.

In this Data Modeling and NoSQL article I will explain in detail about the types of modeling and the strategies used to organize our data. In addition, we will model a project from scratch in NoSQL within Firebase.

What will you learn?

  • Fundamentals of NoSQL Data Modeling in Firebase
  • Strategies for modeling your document and collection databases
  • Conceptual, Logical and Physical Model in practice
  • How to Create an App from your NoSQL Database Model

NoSQL and Firebase fundamentals

In NoSQL we will work with documents and collections. For a better understanding, collections can be understood as traditional tables and documents as if they were the rows (record) of the tables.

The structure behind how the data is organized is in json format. An interesting format for communication between systems.

The main NoSQL databases on the market are MongoDB, CouchDB and Firebase.

The NoSQL framework has the following characteristics:

  • Has a dynamic schema
  • Allows relationships but is not the focus
  • Bad for complex queries
  • Great for performance.

Strategies for Modeling

In NoSQL modeling in Firebase or MongoDB, we will have some ways to design our NoSQL data structure, the possibilities are:

  • UML Diagram (ER)
  • Mental map
  • Document and Collections

In this case, we will follow the document and collections format. The methodology adopted for data modeling is:

For modeling, we must follow the principles:

  • Strategic and fast queries
  • Large collections but small documents
  • Data duplication is allowed
  • Add value instead of using joins

Strategies for NoSQL templating in Firebase are:

  • Strategy 1 : Aggregate data in the document itself
  • Strategy 2: Use sub collections
  • Strategy 3: Create new collections with relationships

Relationships in NoSQL and Firebase

For 1 to 1 relations, we can aggregate the data or use connection through relations.

For 1-to-many and many-to-many relationships, you can choose accordingly:

Modeling a NoSQL project in Firebase from scratch

For a complete NoSQL project, we use an example of a course app.

We had already done SQL data modeling in the relational model and now we did it in the NoSQL model with documents and collections, see how it turned out:

See the video for more details.

What did you learn around here?

  • Ways to design your nosql database
  • Modeling Methodology
  • NoSQL Data Modeling Principles
  • NoSQL Strategies
  • Document relationships and NoSQL collections
  • Firebase in practice.
  • App from scratch with FlutterFlow

Follow us for more content.

More No-Code Start-Up Blog Articles:

premium WordPress plugins
en_USEN

Super Launch

NoCodePRO

All NoCode StartUp Trainings in a single subscription

Start 2024 with a foot in the largest NoCode ecosystem in Brazil! Take advantage of the super launch offer!