- What is the difference between SQL and NoSQL?
- What is referencing and what is embedding in MongoDB?
- Why should we embed more than referencing when we can in MongoDB?
- When should we prefer referencing over nesting in MongoDB?
- What is the difference between a table and a collection?
Created
April 16, 2024 12:52
-
-
Save hiba-machfej/e96e1a7fb01a9dbdd53fb4586df48d11 to your computer and use it in GitHub Desktop.
-
SQL uses tables that have a predefined structure, while NoSQL databases like MongoDB are flexible with how data is stored.
-
In MongoDB, referencing keeps related data in a separate collection and links it using IDs. Embedding puts related data directly in the parent document.
-
Embedding is usually better for performance since it avoids joins. Keeping related data together makes queries faster.
-
Reference if related data may change a lot or get too big. This way it can grow without slowing down the parent document.
-
SQL tables enforce structure and data types, while MongoDB collections are flexible - they can hold different document types.
Written by Room 10 members:
- Zainab Alnajjar
- Zainab Mirza
- Hanan Islam
- Sajad Ismael
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Group : Nada Al Shakiry | Dilan Ahmed | Ahmed Sabah | Helin tayab | Mohammad Sabah
Data modeling and Scalability : data is more stored and organized in table like striucture in SQL but in NoSQL databases are flexible organized similar to JSON. Also, SQL is more vertically modeled data in which we have the date over one big server while we have the data over smaller servers in NoSQL horizontally distributed.
Also they differ in Schema in which SQL is more solid while NoSQL is more dynamic.
they are also differ in Transactions and Use Cases as well.
in referencing the data are associated to each other from one document to another based on the shared id , while in embedding is more like nesting the information inside one collection in which they are related to each other. Also, the referencing is more slower in comparison to embedding and embedding is more faster as there are less queries and faster fetching.
We think it is better to use embedding over using referencing as the embedding is more faster in terms of fetching data and less queries required to return data which makes it more simple in terms of structuring database and manipulation of the data as well. Therefore, it is much better to use embedding over referencing as reference involves more queries and slower, yet the referencing is better usage for complex relational databases.
we think using referencing for having multiple relationships, consistent data, avoiding duplication of data, having large embedded dat.