Some knowledge about Back-end
Published: 2021-12-24 14:57:34

**Difference between NoSQL and SQL:**
SQL database is based on the relational database, whereas NoSQL is based on the non-relational database.
SQL database is structured based on tables, whereas NoSQL structure is not based in tables, rather it is based on document, wide column, key-value stores.
SQL means structured query language which has statically stated schemas. Whereas, NoSQL is unstructured and has dynamic schemas.
SQL has vertical scalability whereas it is horizontal for NoSQL.
SQL is proficient for the relation between different rows, whereas NoSQL is proficient for JSON.
**Mongoose:**
Mongoose is a MongoDB Object Data Modeling library written in Node.js. It is similar to an Object Relational Mapper for standard SQL databases, such as SQLAlchemy. MongoDB is mainly a non-relational database, which means it cannot create any relationship between several collections and tables. As a result, when it arises the need of making relations between tables, mongoose solves that need.
**CRUD Operations:**
CRUD means create, read, update, delete. CRUD operation is possible in Node.js to manipulate MongoDB. Data can be created, updated, read, and deleted in MongoDB. There are some methods to handle CRUD operations. They are described below:

GET: Get method is used to get data to read and execute accordingly from the database. Usually, a fetch method is used where a URL is attached from where the data get fetched. In node.js, declaration of method in the header is not needed as the default value of fetch in node.js is Get. On the other hand in server-side code, a Get method is written and under its closure, necessary commands like findOne{} or find{} is written to fetch data from MongoDB.

POST: The post method is used to save data in the database. On the clent-side, also fetch method can be used with a URL and header where the header contains the ‘POST’ value. To post data, providing the header value is mandatory. In the server side code,  a POST method is written and under its closure, necessary commands like insertOne{} are written to insert data in MongoDB.

PUT: The PUT method is used to update any existing data in the database. On clent-side, also fetch method can be used with a URL and header where the header contains the ‘PUT’ as a value.  In the server-side code,  a PUT method is written and under its closure, necessary commands like updateOne{} or updateMany{} are written to insert data in MongoDB. Another object key value named Upsert can be passed through the PUT method. If the upsert value is true, the data which should be updated does not exist in the first place gets created. Thus if it is false, it doesn’t get created.

DELETE: The delete method is used to delete any data from the database. In the server-side code, a query that should be deleted gets passed through deleteOne{} or deleteMany{} method in order to delete particular data associated with that query.  


**Differences between Nodejs and Javascript:**
Differences between nodejs and javascript are described below-

- 
JavaScript is a client-side scripting language that is lightweight, allows cross-platforming, and is interpreted. Whereas node.js is an environment that helps javascript to run on the server-side which is primarily used for back-end development.

- 
JavaScript is a scripting programming language. Whereas, node.js is an interpreter environment for javascript with some effective library,

- 
JavaScript is capable of running smoothly in any engine such as firefox’s engine, google chromes engine(v8), etc. Whereas, node.js runs only on the v8 engine.

- 
To perform non-blocking tasks, some Javascript objects are used to access the operating system, but they are supported for a particular os system. Whereas, node.js can easily bind with the file system of os very easily, which helps developers to read and write effectively. There is no problem with supporting only a particular os in node.js.