mongod
npm install express cors dotenv mongoose nodemon
start: node server.js
MONGODB_URL=mongodb+srv://sugaraspa:<password>@cluster0.wlju2vn.mongodb.net/?retryWrites=true&w=majority
| Feature | SQL Databases | NoSQL Databases | |——————————|————————————————————————————-|————————————————————————————–| | Data Model | SQL databases are relational and table-based. | NoSQL databases can be document-based, key-value pairs, graph databases, or wide-column stores. This means they don’t adhere to a standard schema. | | Scalability | SQL databases are typically vertically scalable, meaning you increase the power of a single server. | NoSQL databases are horizontally scalable, meaning you add more servers in the pool of resources to handle more traffic. | | Query Language | SQL databases use the structured query language (SQL), which is powerful and standardized. | NoSQL databases often lack a standard query language, sometimes referred to as UnQL. Their query capabilities are not as powerful as SQL. | | Complex Queries | SQL is good for complex queries and is designed for environments where these are common. | NoSQL databases are generally not suitable for complex queries. The interfaces for complex queries are not standardized. | | Support | SQL databases typically have robust vendor and community support, as well as a large number of independent consultants. | Support for NoSQL databases might be less comprehensive, often relying on community support or fewer experts. | Here are the answers in markdown format:
Data with structured schemas and relationships that can be represented in tables with rows and columns.
Customer information for an ecommerce site, with structured data like name, address, order history etc that relate to each other through foreign keys.
Unstructured or semi-structured data without rigid schemas, such as documents, key-value pairs, graphs etc.
Comments or posts on a social media site, which can have varied structures and fields depending on the content.
NoSQL databases like MongoDB are good for hierarchical data storage as they can hold JSON-like documents with nested objects and arrays.
NoSQL databases are more horizontally scalable by adding servers to a cluster. SQL scaling vertically is limited by hardware.
Structured Query Language
a database that uses SQL and stores data in tables with rows and columns
A relational database works with tables as the structure to store data
A schema defines the fields or columns that can exist in a database table. All rows in that table must adhere to the schema.
A NoSQL database is a non-relational database that does not use SQL. Examples are MongoDB, DynamoDB.
NoSQL databases work with collections and documents rather than tables and rows. Documents can have varied, flexible structures.
MongoDB databases contain collections which hold documents.
MongoDB is more flexible since documents can have varying fields. SQL requires fixed schemas
A disadvantage of NoSQL is potential for inconsistent data since documents vary. Joins between data are also harder.