This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Why agnular forms : | |
Angualr form gives key-value object of a form which can be used for multiple purpose . | |
Agnular also give a metadata related to forms. | |
In traditional HTML form we have action="somefunction()" and method="get!post" , but when we use it with angular we do not specify | |
anything to angular, angular itself treat <form> as some kind of directive|compoenent and act on it using formsModule. | |
> Types of angular forms | |
Template Driven From : in this template is fixed and form element is accessed on TS {So angular infer form from DOM side} | |
Reactive Form : in this form configuration is done on TS file Also on TEMPLATE side {form created dynamically and synced with DOM} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> intorductioon | |
mongod is a database server , this should be up and running | |
mongod --port = PORT will be running mongo server on perticular server | |
mongo is a mongoDB shell , this is used to do all mongo operation , thought we haave DRIVERS for all kind of platform | |
Shell command are almost similar as JAVAscript driver for nodejs | |
show dbs > show databases | |
use DataBase_name > create a database | |
db.collectionName.insertOne({JSON_Document}) > create a collection and inserting a document into it |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Introductions | |
when working with project we need to find what kind of structure of our data, what will be ralation between our data | |
We will udnerstand ducuments and other types of data | |
we a will also look into diffreent type of relation, And we will Validate the Data [Schema validation] | |
>Schema | |
Mongo DB supposed to be a schemaless DB but why there is a schema, well MongoDB do not enforce schema as | |
it is enforced by RELATIONAL database. hance creating a schema is an option and as per developers need | |
It is totally developer oriented we can follow any approch, we can forefully insert value by assigninign | |
null to that extra field |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> Introduction | |
This module based on data creating , Data can be crated on mongodb , or it can be imported from other source | |
We will learn about insert method and different ways of importing data into mongo DB | |
> Insert methods | |
ther eare 3 mthods | |
1 ) insertOne({}) this will take one documetns | |
2 ) insertMany({}) this tail ltake multiple documents | |
3 ) insert() It takes both single/ multiple documents |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>Intorduction | |
This module will consist of following | |
1) methods, Filters and Operators for Reading Data | |
2) query selector | |
3) Projection operator | |
>Operators | |
All command include a db.collectionName.MethodName({-parameter-}) | |
parameter can be key value pair or it could be a Range | |
db.collectionName.MethodName({key:{$operator:value}}) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>$set Operator | |
this is used to add update an existing field or add a new field | |
Sysntax : db.collection.updateOne/updateMany({--findQuery--},{$set:{fieldName:"value"}}) | |
> $inc Operator for Increment and Decrement | |
this isus ed to increment / decrement the value | |
Systax : db.collection.updateOne/updateMany({--findQuery--},{$set:{fieldName:"value"} , $inc:{age: INCREMENT_VALUE}}) | |
Note: $inc can be combined with other operator | |
IMP : You can not put $set and $inc on same field , it will throw an error ie updating and incrementing age will cause an error |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Delete one or many items from collection > db.collection.deleteOne/deleteMany(--findCondition--) | |
Delete Collection > db.collection.deleteMAny({}) | |
Delete Entire Collection [Admin task] >>>> db.collection.drop() | |
Delete entire Database [Admin TAsk] >>>> db.deleteDatabase() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>Introduction | |
Indexes are to optimize read, update and delete operation. | |
Indexes load a extra funcnionality while inserting data into DB, mongoDb update indexes whenever a record in inserted | |
db.contacts.getIndexes() // to get all the indexes | |
> Why index are needed | |
By default MongoDB do COLLECTION lookup while read, update and delete operation which is time consuming in sense that | |
Thare is unknown number of records that match condition | |
records position is unknown to mongoDB , HENCE mongoDB iterate over each document looking for matching condition | |
Solution : we can create an index on the column which is frequently used to access records. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Introduction: | |
Aggregation framework is just an alternative for a find method, here there is more controle given to find data in custom format by using | |
$match, $sort, $group, $project | |
This is type of data is only gathered for smaller audiance as we design database based on larger audiance | |
In aggregation we create a pipeline where in data of one operator is passed to other operator | |
Aggregation method: | |
for aggregation we use Aggrigate() method which takes multiple parameter in sequence. Note this aggregation method can take advantage of | |
mongodb indexes. | |
Note: for this tutorial persons.json is used |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
referance : https://scotch.io/tutorials/understanding-hoisting-in-javascript | |
concept: all the declaration of var , let , const , function declaration, class declaration is moved up in run time. | |
var: variable hoisted and get (initialized) default value of "undefined" [variable declared without var are added to global scope] | |
let/ const : variable is hoisted but not assigned to any value | |
function declaration: function declaration is hoisted to upward. | |
Note: function and variable with same name then there will be preferance given to variable assignment over but when variable declaration | |
only then preferance given to function declaration no matter what order they are defined |