Those who want to become a Full Stack Developer their first choice is MEAN Stack because it has a lot of scopes and easy to learn as well but preparing is hard so Here's a Cheat Sheet - Inspired by The Technical Interview Cheat Sheet.md
This list is meant to be both a quick guide and reference for further research into these topics. It's basically a summary of important topics, there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.
- MEAN is a user-friendly full-stack JavaScript framework ideal for building dynamic websites and applications.
- One of the main benefits of the MEAN stack is that a single language, JavaScript, runs on every level of the application, making it an efficient and modern approach to web development.
- MEAN is an acronym for MongoDB, ExpressJS, AngularJS and Node.js
MongoDB is a type of NoSQL DB and used in the following applications such as unstable schema, need highly scalability and availability. Read More
MySQL Terms | MongoDB Terms |
---|---|
database | database |
table | collection |
row | document or BSON document |
column | field |
index | index |
table joins | embedded documents and linking |
primary key Specify any unique column or column combination as the primary key. | primary key In MongoDB, the primary key is automatically set to the _id field. |
aggregation (e.g. group by) | aggregation pipeline |
Read more detailed comparison on MongoDB vs MySQL
Install MongoDB and Robo 3T (Robo 3T -formerly Robomongo is the free lightweight GUI for MongoDB enthusiasts)
Mongoose is MongoDB driver which connects MongoDB and Node.JS Read Document
Everything in Mongoose starts with a Schema. Each schema maps to a MongoDB collection and defines the shape of the documents within that collection.
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var blogSchema = new Schema({
title: String,
author: String,
body: String,
comments: [{ body: String, date: Date }],
date: { type: Date, default: Date.now },
hidden: Boolean,
meta: {
votes: Number,
favs: Number
}
});
To use our schema definition, we need to convert our blogSchema into a Model we can work with. To do so, we pass it into mongoose.model(modelName, schema)
var Blog = mongoose.model('Blog', blogSchema);
Mongoose models provide several static helper functions for CRUD operations.
Save one or more Documents to the database
Shortcut for validating an array of documents and inserting them into MongoDB if they're all valid. This function is faster than .create() because it only sends one operation to the server, rather than one for each document.
Finds one document
Finds documents
Updates one document in the database without returning it.
Same as update(), except it does not support the multi or overwrite options.
Same as update(), except MongoDB will update all documents that match filter
Deletes the first document that matches conditions from the collection.
Deletes all of the documents that match conditions from the collection
Read more about Mongoose Queries
Aggregations are operations that process data records and return computed results
These are operations like sum, count, average, group etc where we need to generated grouped results out of collection. MongoDB exposes a pipeline based framework for aggregations, which looks something like below and Read more
Model.aggregrate([
pipe1_operator : {...},
pipe2_operator : {...},
pipe3_operator : {...}
])
Count the number of Users Belonging To A Particular Region
$match acts as a where condition to filter out documents.
$project is used to add columns dynamically to the collection and use it for further aggregation.
Count Number of User who belong to a certain region
Find all distinct regions
There are many more pipeline operators than dicussed above, which can be seen here
-
A REST stands for Representational State Transfer is an application program interface (API) that uses HTTP requests to GET, PUT, POST and DELETE data.
-
REST is a style of software architecture. As described in a dissertation by Roy Fielding, REST is an "architectural style" that basically exploits the existing technology and protocols of the Web.
RESTful APIs enable you to develop any kind of web application having all possible CRUD operations. REST guidelines suggest using a specific HTTP method on a specific type of call made to the server (though technically it is possible to violate this guideline, yet it is highly discouraged).
Use below-given information to find suitable HTTP method for the action performed by API.
Use GET requests to retrieve resource representation/information only – and not to modify it in any way
POST methods are used to create a new resource into the collection of resources.
Use PUT APIs primarily to update existing resource.
As the name applies, DELETE APIs are used to delete resources.
PATCH requests are to make partial update on a resource
Read more HTTP Methods
Fast, unopinionated, minimalist web framework for node.
Follow this simple instructions by Express Community
const express = require('express')
const app = express()
const port = 3000
app.get('/', (req, res) => res.send('Hello World!'))
app.listen(port, () => console.log(`Example app listening on port ${port}!`))
This app starts a server and listens on port 3000 for connections. The app responds with “Hello World!” for requests to the root URL (/) or route. Read Express Guide to know more about Express Routing