<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Md Nazmul Islam</title>
    <description>The latest articles on DEV Community by Md Nazmul Islam (@devnazmul).</description>
    <link>https://dev.to/devnazmul</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F777155%2F9c4f9b04-90b3-4c79-93a0-bf0a2698c1ee.jpeg</url>
      <title>DEV Community: Md Nazmul Islam</title>
      <link>https://dev.to/devnazmul</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/devnazmul"/>
    <language>en</language>
    <item>
      <title>CRUD Operation</title>
      <dc:creator>Md Nazmul Islam</dc:creator>
      <pubDate>Sat, 25 Dec 2021 13:55:49 +0000</pubDate>
      <link>https://dev.to/devnazmul/crud-operation-3k6e</link>
      <guid>https://dev.to/devnazmul/crud-operation-3k6e</guid>
      <description>&lt;p&gt;MongoDB is a document-oriented database program widely classified as a NoSQL database program.&lt;br&gt;
In MongoDB, the CRUD operation refers to the creating, reading, updating, and deleting documents. Here is an explanation of the operations in detail:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create&lt;/strong&gt;&lt;br&gt;
Create (or insert) operations add new documents to a collection. There are two ways to add new documents to a collection:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;db.collection.insertOne()&lt;/li&gt;
&lt;li&gt;db.collection.insertMany()
insertOne() operation allows us to create individual documents in a collection, while the insertMany() operation is used to create multiple documents in a single operation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Example 1:&lt;/strong&gt;&lt;br&gt;
Here is an example of how we can add a single car to the cars collection using the insertOne() operation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;db.cars.insertOne(
//inserting Bugatti Veyron Mansory Vivere-2005 into cars collection
    {
       name: "Bugatti Veyron Mansory Vivere"
       model: "2005"
    }
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Example 2:&lt;/strong&gt;&lt;br&gt;
Now we will see how we can add info of multiple cars to the cars collection with a single operation using insertMany().&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;db.cars.insertMany([{
//inserting three cars along with their models into cars collection
       name: "Bugatti Veyron Mansory Vivere"
       model: "2005"
},{
       name: "Aston Martin AM-RB 001"
       model: "2018"
},{
       name: "Ferrari Pininfarina Sergio"
       model: "2013"
}])
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Read&lt;/strong&gt;&lt;br&gt;
Read operations retrieve documents from a collection. Here is the method in Mongodb to retrieve information:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;db.collection.find()&lt;br&gt;
find() operation will return everything from a collection if you call it without any parameters. On the other hand, we can specify any filter or criteria to retrieve information from a collection using:&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;db.collection.find(query)&lt;br&gt;
&lt;strong&gt;Example:&lt;/strong&gt;&lt;br&gt;
Here is an example of how we can read information about all cars from the cars collection:&lt;br&gt;
&lt;code&gt;db.cars.find() // no parameters&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{ "_id" : ObjectId("1"), "name" : "Bugatti Veyron Mansory Vivere", "model" : "2005" }
{ "_id" : ObjectId("2"), "name" : "Aston Martin AM-RB 001", "model" : "2018" }
{ "_id" : ObjectId("3"), "name" : "Ferrari Pininfarina Sergio", "2013" : "2005" }

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Update&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Update operations modify existing documents in a collection. There are three ways to update documents of a collection:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;db.collection.updateOne()&lt;br&gt;
– Updates one field in the document where the given criteria or filter meets the condition. Updating a field will not remove the old field instead a new field will be added to the document.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;db.collection.updateMany()&lt;br&gt;
– Updates all fields in the document where the given criteria or filter meets the condition.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;db.collection.replaceOne()&lt;br&gt;
– Replace the entire document. It will replace the old fields and values with new ones.&lt;br&gt;
&lt;strong&gt;Example:&lt;/strong&gt; if we have the following document:&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
   "_id" : ObjectId("1"),
   "model" : 2005
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Using:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;replaceOne({"_id" : ObjectId("1")}, { "new_model" : 2020})&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;will result in:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
   "_id" : ObjectId("1"),
   "new_model" : 2020
}

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;While using:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;updateOne({"_id" : ObjectId("1")}, {$set: { "new_model" : 2020}})&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;Will result in:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
   "_id" : ObjectId("1"),
   "model" : 2005,
   "new_model" : 2020
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;While using:&lt;/strong&gt;&lt;br&gt;
&lt;code&gt;updateMany({"_id" : ObjectId("1")}, {$set: { "name" : "NewName"}, $set: { "new_model" : 2020}})&lt;/code&gt;&lt;br&gt;
&lt;strong&gt;will result in:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{
   "_id" : ObjectId("1"),
   "model" : 2005,
   "new_model" : 2020
   "name" : "newName"
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Delete&lt;/strong&gt;&lt;br&gt;
Delete operations delete documents from a collection. There are two methods to delete documents of a collection:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;db.collection.deleteOne()&lt;/li&gt;
&lt;li&gt;db.collection.deleteMany()
deleteOne() method removes only the first document matched by the query filter document, and deleteMany() deletes multiple objects at once.
&lt;strong&gt;Example 1:&lt;/strong&gt;
Here is an example of how we can remove only one car having the model “2013” from the cars collection:
&lt;code&gt;db.cars.deleteOne(
//deletes one car having model "2013"
{ "model": "2013" }
)&lt;/code&gt;
&lt;strong&gt;Example 2:&lt;/strong&gt;
Here is an example of how all cars, having the model “2013” - can be deleted from the cars collection:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;db.cars.deleteMany(
//delete all cars having model "2013"
    { "model": "2013" }
)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>node</category>
    </item>
    <item>
      <title>JavaScript try - catch - finally Statement</title>
      <dc:creator>Md Nazmul Islam</dc:creator>
      <pubDate>Mon, 20 Dec 2021 09:45:44 +0000</pubDate>
      <link>https://dev.to/devnazmul/javascript-try-catch-finally-statement-1p5g</link>
      <guid>https://dev.to/devnazmul/javascript-try-catch-finally-statement-1p5g</guid>
      <description>&lt;p&gt;The try, catch and finally blocks are used to handle exceptions (a type of an error). Before you learn about them, you need to know about the types of errors in programming.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript try...catch Statement:&lt;/strong&gt;&lt;br&gt;
The try...catch statement is used to handle the exceptions. Its syntax is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try {
    // body of try
} 
catch(error) {
    // body of catch  
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The main code is inside the try block. While executing the try block, if any error occurs, it goes to the catch block. The catch block handles the errors as per the catch statements.&lt;/p&gt;

&lt;p&gt;If no error occurs, the code inside the try block is executed and the catch block is skipped.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript try...catch...finally Statement:&lt;/strong&gt;&lt;br&gt;
You can also use the try...catch...finally statement to handle exceptions. The finally block executes both when the code runs successfully or if an error occurs.&lt;/p&gt;

&lt;p&gt;The syntax of try...catch...finally block is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try {
    // try_statements
} 
catch(error) {
    // catch_statements  
}
finally() {
    // codes that gets executed anyway
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; You need to use catch or finally statement after try statement. Otherwise, the program will throw an error.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JavaScript try...catch in setTimeout:&lt;/strong&gt;&lt;br&gt;
The try...catch won't catch the exception if it happened in "timed" code, like in setTimeout(). For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;try {
    setTimeout(function() {
        // error in the code
    }, 3000);
} catch (e) {
  console.log( "won't work" );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above try...catch won't work because the engine has already left the try..catch construct and the function is executed later.&lt;/p&gt;

&lt;p&gt;The try..catch block must be inside that function to catch an exception inside a timed function. For example,&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;setTimeout(function() {
    try {
        // error in the code
    } catch {
        console.log( "error is caught" );
    }
}, 3000);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can also use the throw statement with the try...catch statement to use user-defined exceptions. For example, a certain number is divided by 0. If you want to consider Infinity as an error in the program, then you can throw a user-defined exception using the throw statement to handle that condition.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>es6</category>
      <category>asynchronus</category>
      <category>webdev</category>
    </item>
    <item>
      <title>2 Essential CSS Properties</title>
      <dc:creator>Md Nazmul Islam</dc:creator>
      <pubDate>Sun, 19 Dec 2021 15:10:48 +0000</pubDate>
      <link>https://dev.to/devnazmul/2-essential-css-properties-213d</link>
      <guid>https://dev.to/devnazmul/2-essential-css-properties-213d</guid>
      <description>&lt;p&gt;&lt;strong&gt;1.Grid&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lmuYnx4---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bvde62rtbyr7f2rpmq0e.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lmuYnx4---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/bvde62rtbyr7f2rpmq0e.jpg" alt="CSS Grid" width="880" height="628"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;CSS Grid Layout is used to divide a page into major parts.&lt;/p&gt;

&lt;p&gt;Like tables, grid layout make an author to align elements into columns and rows. However, by the use of CSS grid we can easily make attractive looked webpages. By using it we can easily make responsive website with pixcl perfection.&lt;/p&gt;

&lt;p&gt;Example:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--kHQI5qRB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ar2xbirdebsrqlbwif5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--kHQI5qRB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ar2xbirdebsrqlbwif5.png" alt="HTML" width="880" height="511"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;CSS:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--lvxedS6D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r7vzr2q2g0l7deg94l9y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--lvxedS6D--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/r7vzr2q2g0l7deg94l9y.png" alt="CSS" width="880" height="1557"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Output:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--pUKNj4kK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zgyys5c4lcwpxdouptvs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--pUKNj4kK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zgyys5c4lcwpxdouptvs.png" alt="Result" width="880" height="283"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2.Flex&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s---VMcTOCY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ibczjl3n09g6bxabsmb.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---VMcTOCY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/8ibczjl3n09g6bxabsmb.jpg" alt="CSS Flex" width="275" height="183"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The flex CSS shorthand property is the combination of flex-grow, flex-shrink, and flex-basis property. It is used to set the length of flexible items. The flex property is much responsive and mobile-friendly. It is easy to position child elements and the main container. The margin doesn’t collapse with the content margins. The order of any element can be easily changed without editing the HTML section.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UfwV_Xlu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ut86cdfol91g84olesu.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UfwV_Xlu--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/9ut86cdfol91g84olesu.png" alt="CSS Flex Syntax" width="880" height="779"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>webdev</category>
      <category>beginners</category>
      <category>html</category>
    </item>
  </channel>
</rss>
