What is the difference strategy of modeling data for a Relational DB (SQL) and NoSQL Document DB?
What does Embedding data mean in NoSQL database?
Treating entities as self-contained items by placing related child data directly inside the parent JSON document
List out 1 example of Embedding data into a JSON document in NoSQL database?
Putting an array of contact details inside a Person document
List out 3 Scenarios where we SHOULD use Embeded Data
When not to emded is just the opposite of this
What is the major drawback of Embedding an array that has “unbounded growth”
embedding millions of comments directly inside a single Blog Post document
The JSON document will grow infinitely large, making the mobile app slow and expensive to operate
What does “Referencing” data mean in a NoSQL database?
Keeping related entities in separate documents and using an ID to connect them
Similar to a Foreign Key (FK) in SQL
List out 3 scenarios that we SHOULD use Reference data
What is a “Hybrid Data Model” in NoSQL?
Mixing both embedding and referencing
a Book document might reference the authorId to keep the full profile separate, but it embeds the authorName and thumbnailUrl so the app doesn’t have to make a second database query just to display the book list.
In a Parking App, a user is limited to registering 3 car number plates. Should you use Embedding or Referencing? Why?
Embedding. This is a One-to-Few relationship. Since the data is small and limited, embedding allows the Flutter app to retrieve the user profile and all plates in a single, fast, and cost-effective database read.
In SQL, we use “JOIN” to combine tables at runtime. Why is this considered a disadvantage for mobile apps compared to NoSQL Embedding?
Performance and Latency. JOINS require the database to do work at the moment you ask for data. In NoSQL, the data is already “composed” (pre-joined) in one document, making it much faster to send to a mobile device.