- 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 are ORMs? Why we use them? Give an example of an SQL request with and without using ORM.
- What is the difference between a table and a collection?
Some helpful resources:
Team: Hayder, Baraa
A1: The main difference between SQL and NoSQL is that SQL is a relational DB, while NoSQL is a non-relational DB.
A2: Referenced documents are stored in a separate collection to their parent document, meanwhile embedding nests documents, simplifying queries
A3: Because embedded documents are efficient and good way to store related data, Referencing should be used more sparingly as there are limitations to referenced documents and references are less efficient.
A4: Referencing is preferred in MongoDB for reducing data duplication, handling frequent updates, and managing shared data efficiently.
A5: ORM is the concept of complicated writing queries using the OOP of whatever programming language you want use. We use it because we can write it in any programming language we're already using, plus it gives us support for transactions, connection pooling, and more. Below are some examples:
Without ORM: SELECT * FROM users WHERE username = 'Ahmad'
With ORM(JavaScript): let user = orm("users").where({ username: 'Ahmad' });
A6: Tables have a fixed schema and adding new columns requires modifying the entire table, collections can contain documents with different structures.