- 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:
Gorgees , Ammar, Lubna
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?
Embedded documents are an efficient and clean way to store related data, especially data that’s regularly accessed together. In general, when designing schemas for MongoDB, you should prefer embedding by default, and use references and application-side or database-side joins only when they’re worthwhile. The more often a given workload can retrieve a single document and have all the data it needs, the more consistently high-performance your application will be.
When should we prefer referencing over nesting in MongoDB?
MongoDB applications use one of two methods to relate documents: Manual references save the _id field of one document in another document as a reference. Your application runs a second query to return the related data. These references are simple and sufficient for most use cases.
Referencing is how you acknowledge the source of the information you have used (referred to) in your work. It helps to make clear to the reader how you have used the work of others to develop your own ideas and arguments.
What are ORMs? Why we use them? Give an example of an SQL request with and without using ORM.
Object Relational Mapping a library that makes it easier to communicate with a database in code. It is basically a technique to query or perform CRUD (Create, Read, Update, Delete) operations to the database, mainly RDBMS (Relational Databases), using an object-oriented paradigm. With the help of ORM, you don"t actually need to use SQL at all. You can directly interact with the database and perform queries in the same language you are using for your back-end code
What is the difference between a table and a collection?
tables have a fixed schema and adding new columns requires modifying the entire table, collections can contain documents with different structures.
Example:
Using Sequelize, the same code would become: