- 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:
1-
SQL databases are primarily called as Relational Databases (RDBMS); whereas NoSQL database are primarily called as non-relational or distributed database.
SQL databases defines and manipulates data based structured query language (SQL) , A NoSQL database has dynamic schema for unstructured data. Data is stored in many ways which means it can be document-oriented
In almost all situations SQL databases are vertically scalable. This means that you can increase the load on a single server by increasing things like RAM, CPU or SSD. But on the other hand NoSQL databases are horizontally scalable. This means that you handle more traffic by sharding, or adding more servers in your NoSQL database
2-
references save the _id field of one document in another document as a reference.
And embedded those types of documents which contain a document inside another document
3-
Because storing them as embedded will just needlessly increase response times due to more queries being executed than needed
4-
When your data is being referred to from multiple locations and you need to access your data from multiple locations, we should be using references
5-
(ORM) is a technique that lets you query and manipulate data from a database using an object-oriented paradigm and it makes it easier to communicate with a database in code
SELECT * FROM users WHERE email = '[email protected]';
and with using ORM:
var orm = require('generic-orm-libarry'); var user = orm("users").where({ email: '[email protected]' });
6-
In SQL database we store are data in column and row (record) and what hold those rows and column called tables and each database can have multiple tables , in case of noSql database like , MongoDb we have collection instead of table and inside each table we have can have multiple documents and inside documents we have multiple fields instead of columns.