- run it with
mongod
npm install express cors dotenv mongoose nodemon
- scripts add start args
start: node server.js
- npm create vite@latest
- npm install bootstrap axios react-bootstrap
- atlas username/ password: sugaraspa/ 66SKR98f5kPTKujN
- into my api to talk to mongoose:(in .env)
MONGODB_URL=mongodb+srv://sugaraspa:<password>@cluster0.wlju2vn.mongodb.net/?retryWrites=true&w=majority
- 5 Differences Between noSQL and SQL:
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: |
- What kind of data is a good fit for an SQL database?
Data with structured schemas and relationships that can be represented in tables with rows and columns.
- Give a real world example.
Customer information for an ecommerce site, with structured data like name, address, order history etc that relate to each other through foreign keys.
- What kind of data is a good fit a NoSQL database?
Unstructured or semi-structured data without rigid schemas, such as documents, key-value pairs, graphs etc.
- Give a real world example.
Comments or posts on a social media site, which can have varied structures and fields depending on the content.
- Which type of database is best for hierarchical data storage?
NoSQL databases like MongoDB are good for hierarchical data storage as they can hold JSON-like documents with nested objects and arrays.
- Which type of database is best for scalability?
NoSQL databases are more horizontally scalable by adding servers to a cluster. SQL scaling vertically is limited by hardware.
- What does SQL stand for?
Structured Query Language
- What is a relational database?
a database that uses SQL and stores data in tables with rows and columns
- What type of structure does a relational database work with?
A relational database works with tables as the structure to store data
- What is a ‘schema’?
A schema defines the fields or columns that can exist in a database table. All rows in that table must adhere to the schema.
- What is a NoSQL database?
A NoSQL database is a non-relational database that does not use SQL. Examples are MongoDB, DynamoDB.
- How does it work?
NoSQL databases work with collections and documents rather than tables and rows. Documents can have varied, flexible structures.
- What is inside of a MongoDB database?
MongoDB databases contain collections which hold documents.
- Which is more flexible - SQL or MongoDB? and why.
MongoDB is more flexible since documents can have varying fields. SQL requires fixed schemas
- What is the disadvantage of a NoSQL database?
A disadvantage of NoSQL is potential for inconsistent data since documents vary. Joins between data are also harder.
- Google Bard and ChatGPT