<?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: KISHAN RAMLAKHAN NISHAD</title>
    <description>The latest articles on DEV Community by KISHAN RAMLAKHAN NISHAD (@kishan45).</description>
    <link>https://dev.to/kishan45</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%2F1429386%2F445e715b-7548-4f89-a504-0c94775c6011.jpg</url>
      <title>DEV Community: KISHAN RAMLAKHAN NISHAD</title>
      <link>https://dev.to/kishan45</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kishan45"/>
    <language>en</language>
    <item>
      <title>Javascript full concept map</title>
      <dc:creator>KISHAN RAMLAKHAN NISHAD</dc:creator>
      <pubDate>Fri, 20 Mar 2026 11:23:40 +0000</pubDate>
      <link>https://dev.to/kishan45/javascript-full-concept-map-4lf</link>
      <guid>https://dev.to/kishan45/javascript-full-concept-map-4lf</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;🟢 Foundations
Variables &amp;amp; Data Types
var / let / constprimitivestype coerciontypeof
Operators &amp;amp; Control Flow
== vs ===loopsswitchternary
Functions
declarationsexpressionsarrow functionsIIFE
Arrays &amp;amp; Objects
methodsdestructuringspread / restiteration
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx3j01z03lzheq4z73jm8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fx3j01z03lzheq4z73jm8.png" alt=" " width="800" height="430"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faxvid85bl1nlp2ayalqi.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Faxvid85bl1nlp2ayalqi.png" alt=" " width="800" height="1217"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title># Lamda , eventbridge, sqs</title>
      <dc:creator>KISHAN RAMLAKHAN NISHAD</dc:creator>
      <pubDate>Thu, 24 Jul 2025 15:00:57 +0000</pubDate>
      <link>https://dev.to/kishan45/-lamda-eventbridge-sqs-3ge1</link>
      <guid>https://dev.to/kishan45/-lamda-eventbridge-sqs-3ge1</guid>
      <description>&lt;h1&gt;
  
  
  Lamda , eventbridge, sqs
&lt;/h1&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Step 1: System Created in organization_webapi&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;When a system is created (e.g., via an API call), the service layer in &lt;code&gt;organization_webapi&lt;/code&gt; handles the logic.&lt;/li&gt;
&lt;li&gt;After saving the system to the database, it &lt;strong&gt;publishes an event&lt;/strong&gt; to EventBridge.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Relevant code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// apps/organization_webapi/app/service/dispatchEvents/index.js&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;postSystem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findOne&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;_id&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;populate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;address&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;evtObj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;EventBridge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;expressReq&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;evtObj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;putEvents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;getEventBridgeEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;org.post.system&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This function fetches the new system, creates an EventBridge event (&lt;code&gt;org.post.system&lt;/code&gt;), and publishes it.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Step 2: EventBridge Receives the Event&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;EventBridge&lt;/strong&gt; is an AWS service that acts as an event bus.&lt;/li&gt;
&lt;li&gt;The event (&lt;code&gt;org.post.system&lt;/code&gt;) is sent to EventBridge.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Configuration for EventBridge is typically found in:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;apps/organization_webapi/yml/Resource/Events.yml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;apps/organization_webapi/serverless/OrganizationEvents.js&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Step 3: EventBridge Forwards Event to SQS&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;There is a rule in EventBridge that matches the event (&lt;code&gt;org.post.system&lt;/code&gt;) and forwards it to an &lt;strong&gt;SQS queue&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;SQS is a queue that temporarily stores the event.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Configuration for this is in:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;apps/organization_webapi/yml/Resource/Events.yml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;apps/organization_webapi/yml/Resource/Resource.yml&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Step 4: Lambda is Triggered by SQS&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;Lambda function&lt;/strong&gt; is set up to listen to the SQS queue.&lt;/li&gt;
&lt;li&gt;When a new event arrives, Lambda is triggered and processes the event.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Lambda handler example (in user_webapi):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// apps/user_webapi/serverless/UserEvents.js&lt;/span&gt;

&lt;span class="nx"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;source&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;org.post.system&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;systemResult&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;SystemService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;expressReq&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;insertSystem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;UserService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;expressReq&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;attachedSystemToFirstUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;systemResult&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

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

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This code listens for the &lt;code&gt;org.post.system&lt;/code&gt; event and creates the system in the user service.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Step 5: user_webapi Creates the System&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The Lambda function (above) calls the user service logic to create the system in the user database.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Summary Table&lt;/strong&gt;
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Step&lt;/th&gt;
&lt;th&gt;Service/Component&lt;/th&gt;
&lt;th&gt;File/Folder Example&lt;/th&gt;
&lt;th&gt;What Happens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;organization_webapi&lt;/td&gt;
&lt;td&gt;&lt;code&gt;app/service/dispatchEvents/index.js&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;System is created, event is published to EventBridge&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;EventBridge&lt;/td&gt;
&lt;td&gt;&lt;code&gt;yml/Resource/Events.yml&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;EventBridge receives the event&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;SQS&lt;/td&gt;
&lt;td&gt;&lt;code&gt;yml/Resource/Resource.yml&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;EventBridge forwards event to SQS queue&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Lambda&lt;/td&gt;
&lt;td&gt;&lt;code&gt;serverless/UserEvents.js&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lambda is triggered by SQS, processes event&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;user_webapi&lt;/td&gt;
&lt;td&gt;&lt;code&gt;app/service/system.js&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;System is created in user database&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;In Simple Terms&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;organization_webapi&lt;/strong&gt; creates a system and tells EventBridge.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EventBridge&lt;/strong&gt; forwards the event to an SQS queue.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lambda&lt;/strong&gt; picks up the event from SQS and tells &lt;strong&gt;user_webapi&lt;/strong&gt; to create the same system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;user_webapi&lt;/strong&gt; creates the system for the user.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;If you want to see the actual YAML/serverless config or more code for any step, let me know!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>lamda</title>
      <dc:creator>KISHAN RAMLAKHAN NISHAD</dc:creator>
      <pubDate>Tue, 01 Jul 2025 12:07:34 +0000</pubDate>
      <link>https://dev.to/kishan45/lamda-11fc</link>
      <guid>https://dev.to/kishan45/lamda-11fc</guid>
      <description>&lt;p&gt;Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Ran tool&lt;br&gt;
Read file: apps/organization_webapi/app/service/dispatchEvents/index.js&lt;br&gt;
Here’s a &lt;strong&gt;step-by-step walkthrough&lt;/strong&gt; of the whole flow, with code references and simple explanations for each step:&lt;/p&gt;


&lt;h2&gt;
  
  
  &lt;strong&gt;Step 1: System Created in organization_webapi&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;When a system is created (e.g., via an API call), the service layer in &lt;code&gt;organization_webapi&lt;/code&gt; handles the logic.&lt;/li&gt;
&lt;li&gt;After saving the system to the database, it &lt;strong&gt;publishes an event&lt;/strong&gt; to EventBridge.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Relevant code:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// apps/organization_webapi/app/service/dispatchEvents/index.js&lt;/span&gt;

&lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;postSystem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;_id&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;Model&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;findOne&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;_id&lt;/span&gt; &lt;span class="p"&gt;}).&lt;/span&gt;&lt;span class="nf"&gt;populate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;address&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;evtObj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;EventBridge&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;expressReq&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;evtObj&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;putEvents&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;getEventBridgeEvent&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;org.post.system&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This function fetches the new system, creates an EventBridge event (&lt;code&gt;org.post.system&lt;/code&gt;), and publishes it.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Step 2: EventBridge Receives the Event&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;EventBridge&lt;/strong&gt; is an AWS service that acts as an event bus.&lt;/li&gt;
&lt;li&gt;The event (&lt;code&gt;org.post.system&lt;/code&gt;) is sent to EventBridge.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Configuration for EventBridge is typically found in:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;apps/organization_webapi/yml/Resource/Events.yml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;apps/organization_webapi/serverless/OrganizationEvents.js&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Step 3: EventBridge Forwards Event to SQS&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;There is a rule in EventBridge that matches the event (&lt;code&gt;org.post.system&lt;/code&gt;) and forwards it to an &lt;strong&gt;SQS queue&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;SQS is a queue that temporarily stores the event.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Configuration for this is in:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;code&gt;apps/organization_webapi/yml/Resource/Events.yml&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;apps/organization_webapi/yml/Resource/Resource.yml&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Step 4: Lambda is Triggered by SQS&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;Lambda function&lt;/strong&gt; is set up to listen to the SQS queue.&lt;/li&gt;
&lt;li&gt;When a new event arrives, Lambda is triggered and processes the event.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Lambda handler example (in user_webapi):&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// apps/user_webapi/serverless/UserEvents.js&lt;/span&gt;

&lt;span class="nx"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;source&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;org.post.system&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;systemResult&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;SystemService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;expressReq&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;insertSystem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;UserService&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;expressReq&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;attachedSystemToFirstUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;systemResult&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;_id&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="nx"&gt;exports&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="nx"&gt;event&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;Router&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;listen&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;This code listens for the &lt;code&gt;org.post.system&lt;/code&gt; event and creates the system in the user service.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Step 5: user_webapi Creates the System&lt;/strong&gt;
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The Lambda function (above) calls the user service logic to create the system in the user database.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;Summary Table&lt;/strong&gt;
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Step&lt;/th&gt;
&lt;th&gt;Service/Component&lt;/th&gt;
&lt;th&gt;File/Folder Example&lt;/th&gt;
&lt;th&gt;What Happens&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;td&gt;organization_webapi&lt;/td&gt;
&lt;td&gt;&lt;code&gt;app/service/dispatchEvents/index.js&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;System is created, event is published to EventBridge&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;2&lt;/td&gt;
&lt;td&gt;EventBridge&lt;/td&gt;
&lt;td&gt;&lt;code&gt;yml/Resource/Events.yml&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;EventBridge receives the event&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;3&lt;/td&gt;
&lt;td&gt;SQS&lt;/td&gt;
&lt;td&gt;&lt;code&gt;yml/Resource/Resource.yml&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;EventBridge forwards event to SQS queue&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;4&lt;/td&gt;
&lt;td&gt;Lambda&lt;/td&gt;
&lt;td&gt;&lt;code&gt;serverless/UserEvents.js&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;Lambda is triggered by SQS, processes event&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;5&lt;/td&gt;
&lt;td&gt;user_webapi&lt;/td&gt;
&lt;td&gt;&lt;code&gt;app/service/system.js&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;System is created in user database&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;In Simple Terms&lt;/strong&gt;
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;organization_webapi&lt;/strong&gt; creates a system and tells EventBridge.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;EventBridge&lt;/strong&gt; forwards the event to an SQS queue.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Lambda&lt;/strong&gt; picks up the event from SQS and tells &lt;strong&gt;user_webapi&lt;/strong&gt; to create the same system.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;user_webapi&lt;/strong&gt; creates the system for the user.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;If you want to see the actual YAML/serverless config or more code for any step, let me know!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>MongoDB Query Reference - Basic to Advanced</title>
      <dc:creator>KISHAN RAMLAKHAN NISHAD</dc:creator>
      <pubDate>Tue, 01 Jul 2025 12:07:19 +0000</pubDate>
      <link>https://dev.to/kishan45/mongodb-query-reference-basic-to-advanced-11j7</link>
      <guid>https://dev.to/kishan45/mongodb-query-reference-basic-to-advanced-11j7</guid>
      <description>&lt;ol&gt;
&lt;li&gt;Basic CRUD Operations
Create (Insert)
javascript
// Insert one document
db.collection.insertOne({name: "John", age: 30, city: "New York"})&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// Insert multiple documents&lt;br&gt;
db.collection.insertMany([&lt;br&gt;
  {name: "Alice", age: 25, city: "London"},&lt;br&gt;
  {name: "Bob", age: 35, city: "Paris"}&lt;br&gt;
])&lt;br&gt;
Read (Find)&lt;br&gt;
javascript&lt;br&gt;
// Find all documents&lt;br&gt;
db.collection.find()&lt;/p&gt;

&lt;p&gt;// Find with condition&lt;br&gt;
db.collection.find({age: 30})&lt;/p&gt;

&lt;p&gt;// Find one document&lt;br&gt;
db.collection.findOne({name: "John"})&lt;/p&gt;

&lt;p&gt;// Pretty print&lt;br&gt;
db.collection.find().pretty()&lt;br&gt;
Update&lt;br&gt;
javascript&lt;br&gt;
// Update one document&lt;br&gt;
db.collection.updateOne(&lt;br&gt;
  {name: "John"},&lt;br&gt;
  {$set: {age: 31}}&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;// Update multiple documents&lt;br&gt;
db.collection.updateMany(&lt;br&gt;
  {city: "London"},&lt;br&gt;
  {$set: {country: "UK"}}&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;// Replace entire document&lt;br&gt;
db.collection.replaceOne(&lt;br&gt;
  {name: "John"},&lt;br&gt;
  {name: "John", age: 32, city: "Boston"}&lt;br&gt;
)&lt;br&gt;
Delete&lt;br&gt;
javascript&lt;br&gt;
// Delete one document&lt;br&gt;
db.collection.deleteOne({name: "John"})&lt;/p&gt;

&lt;p&gt;// Delete multiple documents&lt;br&gt;
db.collection.deleteMany({age: {$lt: 25}})&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Query Operators
Comparison Operators
javascript
// Equal
db.collection.find({age: 30})&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// Not equal&lt;br&gt;
db.collection.find({age: {$ne: 30}})&lt;/p&gt;

&lt;p&gt;// Greater than&lt;br&gt;
db.collection.find({age: {$gt: 30}})&lt;/p&gt;

&lt;p&gt;// Greater than or equal&lt;br&gt;
db.collection.find({age: {$gte: 30}})&lt;/p&gt;

&lt;p&gt;// Less than&lt;br&gt;
db.collection.find({age: {$lt: 30}})&lt;/p&gt;

&lt;p&gt;// Less than or equal&lt;br&gt;
db.collection.find({age: {$lte: 30}})&lt;/p&gt;

&lt;p&gt;// In array of values&lt;br&gt;
db.collection.find({age: {$in: [25, 30, 35]}})&lt;/p&gt;

&lt;p&gt;// Not in array&lt;br&gt;
db.collection.find({age: {$nin: [25, 30, 35]}})&lt;br&gt;
Logical Operators&lt;br&gt;
javascript&lt;br&gt;
// AND (implicit)&lt;br&gt;
db.collection.find({age: 30, city: "London"})&lt;/p&gt;

&lt;p&gt;// AND (explicit)&lt;br&gt;
db.collection.find({$and: [{age: 30}, {city: "London"}]})&lt;/p&gt;

&lt;p&gt;// OR&lt;br&gt;
db.collection.find({$or: [{age: 30}, {city: "London"}]})&lt;/p&gt;

&lt;p&gt;// NOT&lt;br&gt;
db.collection.find({age: {$not: {$gt: 30}}})&lt;/p&gt;

&lt;p&gt;// NOR&lt;br&gt;
db.collection.find({$nor: [{age: 30}, {city: "London"}]})&lt;br&gt;
Element Operators&lt;br&gt;
javascript&lt;br&gt;
// Field exists&lt;br&gt;
db.collection.find({email: {$exists: true}})&lt;/p&gt;

&lt;p&gt;// Field doesn't exist&lt;br&gt;
db.collection.find({email: {$exists: false}})&lt;/p&gt;

&lt;p&gt;// Type check&lt;br&gt;
db.collection.find({age: {$type: "number"}})&lt;br&gt;
db.collection.find({age: {$type: 16}}) // 16 = 32-bit integer&lt;br&gt;
Array Operators&lt;br&gt;
javascript&lt;br&gt;
// All elements match&lt;br&gt;
db.collection.find({tags: {$all: ["red", "blue"]}})&lt;/p&gt;

&lt;p&gt;// Array size&lt;br&gt;
db.collection.find({tags: {$size: 3}})&lt;/p&gt;

&lt;p&gt;// Element match (for arrays of objects)&lt;br&gt;
db.collection.find({&lt;br&gt;
  scores: {$elemMatch: {score: {$gt: 80}, subject: "math"}}&lt;br&gt;
})&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Regular Expressions
javascript
// Case-sensitive regex
db.collection.find({name: /^J/})&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// Case-insensitive regex&lt;br&gt;
db.collection.find({name: /john/i})&lt;/p&gt;

&lt;p&gt;// Using $regex operator&lt;br&gt;
db.collection.find({name: {$regex: "john", $options: "i"}})&lt;/p&gt;

&lt;p&gt;// Complex patterns&lt;br&gt;
db.collection.find({email: {$regex: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+.[a-zA-Z]{2,}$/}})&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Projection
javascript
// Include specific fields
db.collection.find({}, {name: 1, age: 1})&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// Exclude specific fields&lt;br&gt;
db.collection.find({}, {password: 0, ssn: 0})&lt;/p&gt;

&lt;p&gt;// Include field in nested document&lt;br&gt;
db.collection.find({}, {"address.city": 1})&lt;/p&gt;

&lt;p&gt;// Array element projection&lt;br&gt;
db.collection.find({}, {tags: {$slice: 2}}) // First 2 elements&lt;br&gt;
db.collection.find({}, {tags: {$slice: -2}}) // Last 2 elements&lt;br&gt;
db.collection.find({}, {tags: {$slice: [1, 3]}}) // Skip 1, take 3&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Sorting and Limiting
javascript
// Sort ascending
db.collection.find().sort({age: 1})&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// Sort descending&lt;br&gt;
db.collection.find().sort({age: -1})&lt;/p&gt;

&lt;p&gt;// Multiple sort fields&lt;br&gt;
db.collection.find().sort({age: -1, name: 1})&lt;/p&gt;

&lt;p&gt;// Limit results&lt;br&gt;
db.collection.find().limit(5)&lt;/p&gt;

&lt;p&gt;// Skip documents&lt;br&gt;
db.collection.find().skip(10)&lt;/p&gt;

&lt;p&gt;// Pagination&lt;br&gt;
db.collection.find().skip(20).limit(10)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Aggregation Framework
Basic Pipeline
javascript
db.collection.aggregate([
{$match: {age: {$gte: 25}}},
{$group: {_id: "$city", count: {$sum: 1}}},
{$sort: {count: -1}}
])
Common Pipeline Stages
javascript
// $match - Filter documents
{$match: {status: "active"}}&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// $group - Group documents&lt;br&gt;
{$group: {&lt;br&gt;
  _id: "$category",&lt;br&gt;
  total: {$sum: "$amount"},&lt;br&gt;
  avg: {$avg: "$amount"},&lt;br&gt;
  count: {$sum: 1}&lt;br&gt;
}}&lt;/p&gt;

&lt;p&gt;// $project - Reshape documents&lt;br&gt;
{$project: {&lt;br&gt;
  name: 1,&lt;br&gt;
  age: 1,&lt;br&gt;
  fullName: {$concat: ["$firstName", " ", "$lastName"]},&lt;br&gt;
  isAdult: {$gte: ["$age", 18]}&lt;br&gt;
}}&lt;/p&gt;

&lt;p&gt;// $sort - Sort documents&lt;br&gt;
{$sort: {age: -1, name: 1}}&lt;/p&gt;

&lt;p&gt;// $limit - Limit results&lt;br&gt;
{$limit: 10}&lt;/p&gt;

&lt;p&gt;// $skip - Skip documents&lt;br&gt;
{$skip: 5}&lt;/p&gt;

&lt;p&gt;// $unwind - Deconstruct arrays&lt;br&gt;
{$unwind: "$tags"}&lt;/p&gt;

&lt;p&gt;// $lookup - Join collections&lt;br&gt;
{$lookup: {&lt;br&gt;
  from: "orders",&lt;br&gt;
  localField: "_id",&lt;br&gt;
  foreignField: "userId",&lt;br&gt;
  as: "userOrders"&lt;br&gt;
}}&lt;br&gt;
Advanced Aggregation Examples&lt;br&gt;
javascript&lt;br&gt;
// Complex grouping with multiple operations&lt;br&gt;
db.sales.aggregate([&lt;br&gt;
  {$match: {date: {$gte: new Date("2023-01-01")}}},&lt;br&gt;
  {$group: {&lt;br&gt;
    _id: {&lt;br&gt;
      year: {$year: "$date"},&lt;br&gt;
      month: {$month: "$date"},&lt;br&gt;
      product: "$product"&lt;br&gt;
    },&lt;br&gt;
    totalSales: {$sum: "$amount"},&lt;br&gt;
    averageSale: {$avg: "$amount"},&lt;br&gt;
    minSale: {$min: "$amount"},&lt;br&gt;
    maxSale: {$max: "$amount"},&lt;br&gt;
    salesCount: {$sum: 1}&lt;br&gt;
  }},&lt;br&gt;
  {$sort: {"_id.year": 1, "_id.month": 1}},&lt;br&gt;
  {$project: {&lt;br&gt;
    _id: 0,&lt;br&gt;
    year: "$_id.year",&lt;br&gt;
    month: "$_id.month",&lt;br&gt;
    product: "$_id.product",&lt;br&gt;
    totalSales: 1,&lt;br&gt;
    averageSale: {$round: ["$averageSale", 2]},&lt;br&gt;
    salesCount: 1&lt;br&gt;
  }}&lt;br&gt;
])&lt;/p&gt;

&lt;p&gt;// Lookup with pipeline&lt;br&gt;
db.users.aggregate([&lt;br&gt;
  {$lookup: {&lt;br&gt;
    from: "orders",&lt;br&gt;
    let: {userId: "$_id"},&lt;br&gt;
    pipeline: [&lt;br&gt;
      {$match: {$expr: {$eq: ["$userId", "$$userId"]}}},&lt;br&gt;
      {$match: {status: "completed"}},&lt;br&gt;
      {$group: {_id: null, total: {$sum: "$amount"}}}&lt;br&gt;
    ],&lt;br&gt;
    as: "completedOrders"&lt;br&gt;
  }}&lt;br&gt;
])&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Indexing
Creating Indexes
javascript
// Single field index
db.collection.createIndex({name: 1})&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// Compound index&lt;br&gt;
db.collection.createIndex({name: 1, age: -1})&lt;/p&gt;

&lt;p&gt;// Text index&lt;br&gt;
db.collection.createIndex({title: "text", content: "text"})&lt;/p&gt;

&lt;p&gt;// Geospatial index&lt;br&gt;
db.collection.createIndex({location: "2dsphere"})&lt;/p&gt;

&lt;p&gt;// Partial index&lt;br&gt;
db.collection.createIndex(&lt;br&gt;
  {email: 1},&lt;br&gt;
  {partialFilterExpression: {email: {$exists: true}}}&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;// TTL index (auto-expire documents)&lt;br&gt;
db.collection.createIndex(&lt;br&gt;
  {createdAt: 1},&lt;br&gt;
  {expireAfterSeconds: 3600}&lt;br&gt;
)&lt;br&gt;
Index Management&lt;br&gt;
javascript&lt;br&gt;
// List indexes&lt;br&gt;
db.collection.getIndexes()&lt;/p&gt;

&lt;p&gt;// Drop index&lt;br&gt;
db.collection.dropIndex({name: 1})&lt;br&gt;
db.collection.dropIndex("name_1")&lt;/p&gt;

&lt;p&gt;// Drop all indexes&lt;br&gt;
db.collection.dropIndexes()&lt;/p&gt;

&lt;p&gt;// Explain query plan&lt;br&gt;
db.collection.find({name: "John"}).explain("executionStats")&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Advanced Update Operations
Update Operators
javascript
// $set - Set field value
db.collection.updateOne({_id: 1}, {$set: {age: 31}})&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// $unset - Remove field&lt;br&gt;
db.collection.updateOne({_id: 1}, {$unset: {age: ""}})&lt;/p&gt;

&lt;p&gt;// $inc - Increment field&lt;br&gt;
db.collection.updateOne({_id: 1}, {$inc: {age: 1, views: 10}})&lt;/p&gt;

&lt;p&gt;// $mul - Multiply field&lt;br&gt;
db.collection.updateOne({_id: 1}, {$mul: {price: 1.1}})&lt;/p&gt;

&lt;p&gt;// $min/$max - Update if new value is min/max&lt;br&gt;
db.collection.updateOne({_id: 1}, {$min: {lowScore: 50}})&lt;br&gt;
db.collection.updateOne({_id: 1}, {$max: {highScore: 100}})&lt;/p&gt;

&lt;p&gt;// $currentDate - Set to current date&lt;br&gt;
db.collection.updateOne({_id: 1}, {$currentDate: {lastModified: true}})&lt;br&gt;
Array Update Operators&lt;br&gt;
javascript&lt;br&gt;
// $push - Add element to array&lt;br&gt;
db.collection.updateOne({_id: 1}, {$push: {tags: "new-tag"}})&lt;/p&gt;

&lt;p&gt;// $push with $each (multiple elements)&lt;br&gt;
db.collection.updateOne({_id: 1}, {$push: {tags: {$each: ["tag1", "tag2"]}}})&lt;/p&gt;

&lt;p&gt;// $addToSet - Add unique element&lt;br&gt;
db.collection.updateOne({_id: 1}, {$addToSet: {tags: "unique-tag"}})&lt;/p&gt;

&lt;p&gt;// $pop - Remove first or last element&lt;br&gt;
db.collection.updateOne({_id: 1}, {$pop: {tags: 1}}) // Remove last&lt;br&gt;
db.collection.updateOne({_id: 1}, {$pop: {tags: -1}}) // Remove first&lt;/p&gt;

&lt;p&gt;// $pull - Remove elements matching condition&lt;br&gt;
db.collection.updateOne({_id: 1}, {$pull: {tags: "old-tag"}})&lt;br&gt;
db.collection.updateOne({_id: 1}, {$pull: {scores: {$lt: 50}}})&lt;/p&gt;

&lt;p&gt;// $pullAll - Remove multiple specific values&lt;br&gt;
db.collection.updateOne({_id: 1}, {$pullAll: {tags: ["tag1", "tag2"]}})&lt;/p&gt;

&lt;p&gt;// Update array element by position&lt;br&gt;
db.collection.updateOne({_id: 1}, {$set: {"tags.0": "first-tag"}})&lt;/p&gt;

&lt;p&gt;// Update array element by condition ($ positional operator)&lt;br&gt;
db.collection.updateOne(&lt;br&gt;
  {"scores.score": 85},&lt;br&gt;
  {$set: {"scores.$.grade": "B"}}&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;// Update all array elements ($[] positional operator)&lt;br&gt;
db.collection.updateOne(&lt;br&gt;
  {_id: 1},&lt;br&gt;
  {$inc: {"scores.$[].attempts": 1}}&lt;br&gt;
)&lt;/p&gt;

&lt;p&gt;// Update filtered array elements ($[identifier] positional operator)&lt;br&gt;
db.collection.updateOne(&lt;br&gt;
  {_id: 1},&lt;br&gt;
  {$set: {"scores.$[elem].grade": "A"}},&lt;br&gt;
  {arrayFilters: [{"elem.score": {$gte: 90}}]}&lt;br&gt;
)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Text Search
javascript
// Create text index
db.articles.createIndex({title: "text", content: "text"})&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// Basic text search&lt;br&gt;
db.articles.find({$text: {$search: "mongodb database"}})&lt;/p&gt;

&lt;p&gt;// Search with phrases&lt;br&gt;
db.articles.find({$text: {$search: "\"exact phrase\""}})&lt;/p&gt;

&lt;p&gt;// Exclude terms&lt;br&gt;
db.articles.find({$text: {$search: "mongodb -sql"}})&lt;/p&gt;

&lt;p&gt;// Text search with score&lt;br&gt;
db.articles.find(&lt;br&gt;
  {$text: {$search: "mongodb"}},&lt;br&gt;
  {score: {$meta: "textScore"}}&lt;br&gt;
).sort({score: {$meta: "textScore"}})&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Geospatial Queries
javascript
// Create 2dsphere index
db.places.createIndex({location: "2dsphere"})&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// Find near point&lt;br&gt;
db.places.find({&lt;br&gt;
  location: {&lt;br&gt;
    $near: {&lt;br&gt;
      $geometry: {type: "Point", coordinates: [-73.9857, 40.7484]},&lt;br&gt;
      $maxDistance: 1000&lt;br&gt;
    }&lt;br&gt;
  }&lt;br&gt;
})&lt;/p&gt;

&lt;p&gt;// Find within polygon&lt;br&gt;
db.places.find({&lt;br&gt;
  location: {&lt;br&gt;
    $geoWithin: {&lt;br&gt;
      $geometry: {&lt;br&gt;
        type: "Polygon",&lt;br&gt;
        coordinates: [[&lt;br&gt;
          [-74, 40.5],&lt;br&gt;
          [-74, 41],&lt;br&gt;
          [-73, 41],&lt;br&gt;
          [-73, 40.5],&lt;br&gt;
          [-74, 40.5]&lt;br&gt;
        ]]&lt;br&gt;
      }&lt;br&gt;
    }&lt;br&gt;
  }&lt;br&gt;
})&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Advanced Aggregation Operators
Conditional Operators
javascript
// $cond - Conditional expression
{$project: {
status: {
$cond: {
  if: {$gte: ["$age", 18]},
  then: "adult",
  else: "minor"
}
}
}}&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// $switch - Multiple conditions&lt;br&gt;
{$project: {&lt;br&gt;
  grade: {&lt;br&gt;
    $switch: {&lt;br&gt;
      branches: [&lt;br&gt;
        {case: {$gte: ["$score", 90]}, then: "A"},&lt;br&gt;
        {case: {$gte: ["$score", 80]}, then: "B"},&lt;br&gt;
        {case: {$gte: ["$score", 70]}, then: "C"}&lt;br&gt;
      ],&lt;br&gt;
      default: "F"&lt;br&gt;
    }&lt;br&gt;
  }&lt;br&gt;
}}&lt;br&gt;
Date Operators&lt;br&gt;
javascript&lt;br&gt;
// Extract date parts&lt;br&gt;
{$project: {&lt;br&gt;
  year: {$year: "$createdAt"},&lt;br&gt;
  month: {$month: "$createdAt"},&lt;br&gt;
  dayOfWeek: {$dayOfWeek: "$createdAt"},&lt;br&gt;
  dayOfYear: {$dayOfYear: "$createdAt"}&lt;br&gt;
}}&lt;/p&gt;

&lt;p&gt;// Date arithmetic&lt;br&gt;
{$project: {&lt;br&gt;
  futureDate: {$add: ["$createdAt", 7 * 24 * 60 * 60 * 1000]} // Add 7 days&lt;br&gt;
}}&lt;/p&gt;

&lt;p&gt;// Date formatting&lt;br&gt;
{$project: {&lt;br&gt;
  formattedDate: {&lt;br&gt;
    $dateToString: {&lt;br&gt;
      format: "%Y-%m-%d %H:%M:%S",&lt;br&gt;
      date: "$createdAt"&lt;br&gt;
    }&lt;br&gt;
  }&lt;br&gt;
}}&lt;br&gt;
String Operators&lt;br&gt;
javascript&lt;br&gt;
// String manipulation&lt;br&gt;
{$project: {&lt;br&gt;
  upperName: {$toUpper: "$name"},&lt;br&gt;
  lowerName: {$toLower: "$name"},&lt;br&gt;
  nameLength: {$strLenCP: "$name"},&lt;br&gt;
  initials: {$substr: ["$name", 0, 1]},&lt;br&gt;
  fullName: {$concat: ["$firstName", " ", "$lastName"]},&lt;br&gt;
  words: {$split: ["$name", " "]}&lt;br&gt;
}}&lt;/p&gt;

&lt;p&gt;// String search&lt;br&gt;
{$match: {&lt;br&gt;
  $expr: {&lt;br&gt;
    $regexMatch: {&lt;br&gt;
      input: "$email",&lt;br&gt;
      regex: "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$"&lt;br&gt;
    }&lt;br&gt;
  }&lt;br&gt;
}}&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Complex Aggregation Examples
Data Analysis Pipeline
javascript
db.sales.aggregate([
// Stage 1: Filter recent sales
{$match: {
date: {$gte: new Date("2023-01-01")},
status: "completed"
}},&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// Stage 2: Add calculated fields&lt;br&gt;
  {$addFields: {&lt;br&gt;
    month: {$month: "$date"},&lt;br&gt;
    year: {$year: "$date"},&lt;br&gt;
    profit: {$subtract: ["$revenue", "$cost"]}&lt;br&gt;
  }},&lt;/p&gt;

&lt;p&gt;// Stage 3: Group by product and month&lt;br&gt;
  {$group: {&lt;br&gt;
    _id: {&lt;br&gt;
      product: "$product",&lt;br&gt;
      year: "$year",&lt;br&gt;
      month: "$month"&lt;br&gt;
    },&lt;br&gt;
    totalRevenue: {$sum: "$revenue"},&lt;br&gt;
    totalProfit: {$sum: "$profit"},&lt;br&gt;
    avgOrderValue: {$avg: "$revenue"},&lt;br&gt;
    orderCount: {$sum: 1},&lt;br&gt;
    topCustomer: {$first: "$customer"}&lt;br&gt;
  }},&lt;/p&gt;

&lt;p&gt;// Stage 4: Calculate profit margin&lt;br&gt;
  {$addFields: {&lt;br&gt;
    profitMargin: {&lt;br&gt;
      $multiply: [&lt;br&gt;
        {$divide: ["$totalProfit", "$totalRevenue"]},&lt;br&gt;
        100&lt;br&gt;
      ]&lt;br&gt;
    }&lt;br&gt;
  }},&lt;/p&gt;

&lt;p&gt;// Stage 5: Sort by profit margin&lt;br&gt;
  {$sort: {profitMargin: -1}},&lt;/p&gt;

&lt;p&gt;// Stage 6: Group by product for summary&lt;br&gt;
  {$group: {&lt;br&gt;
    _id: "$_id.product",&lt;br&gt;
    monthlyData: {&lt;br&gt;
      $push: {&lt;br&gt;
        year: "$_id.year",&lt;br&gt;
        month: "$_id.month",&lt;br&gt;
        revenue: "$totalRevenue",&lt;br&gt;
        profit: "$totalProfit",&lt;br&gt;
        margin: "$profitMargin",&lt;br&gt;
        orders: "$orderCount"&lt;br&gt;
      }&lt;br&gt;
    },&lt;br&gt;
    totalRevenue: {$sum: "$totalRevenue"},&lt;br&gt;
    avgMargin: {$avg: "$profitMargin"}&lt;br&gt;
  }},&lt;/p&gt;

&lt;p&gt;// Stage 7: Final projection&lt;br&gt;
  {$project: {&lt;br&gt;
    _id: 0,&lt;br&gt;
    product: "$_id",&lt;br&gt;
    totalRevenue: 1,&lt;br&gt;
    avgMargin: {$round: ["$avgMargin", 2]},&lt;br&gt;
    monthlyData: 1,&lt;br&gt;
    performance: {&lt;br&gt;
      $cond: {&lt;br&gt;
        if: {$gte: ["$avgMargin", 20]},&lt;br&gt;
        then: "excellent",&lt;br&gt;
        else: {&lt;br&gt;
          $cond: {&lt;br&gt;
            if: {$gte: ["$avgMargin", 10]},&lt;br&gt;
            then: "good",&lt;br&gt;
            else: "needs_improvement"&lt;br&gt;
          }&lt;br&gt;
        }&lt;br&gt;
      }&lt;br&gt;
    }&lt;br&gt;
  }}&lt;br&gt;
])&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Performance Optimization Tips
Query Optimization
javascript
// Use indexes effectively
db.collection.find({status: "active", category: "electronics"})
// Create compound index: db.collection.createIndex({status: 1, category: 1})&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;// Use projection to limit data transfer&lt;br&gt;
db.collection.find({status: "active"}, {name: 1, price: 1})&lt;/p&gt;

&lt;p&gt;// Use hint to force index usage&lt;br&gt;
db.collection.find({name: "John"}).hint({name: 1})&lt;/p&gt;

&lt;p&gt;// Use explain to analyze query performance&lt;br&gt;
db.collection.find({name: "John"}).explain("executionStats")&lt;br&gt;
Aggregation Optimization&lt;br&gt;
javascript&lt;br&gt;
// Put $match as early as possible&lt;br&gt;
db.collection.aggregate([&lt;br&gt;
  {$match: {status: "active"}}, // Filter first&lt;br&gt;
  {$lookup: {...}},&lt;br&gt;
  {$group: {...}}&lt;br&gt;
])&lt;/p&gt;

&lt;p&gt;// Use $project to reduce document size early&lt;br&gt;
db.collection.aggregate([&lt;br&gt;
  {$match: {status: "active"}},&lt;br&gt;
  {$project: {name: 1, age: 1, city: 1}}, // Reduce data size&lt;br&gt;
  {$group: {...}}&lt;br&gt;
])&lt;br&gt;
This comprehensive guide covers MongoDB queries from basic CRUD operations to advanced aggregation pipelines and optimization techniques. Each section builds upon the previous ones, providing practical examples you can use in real applications.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How do I find my connection string in Atlas?</title>
      <dc:creator>KISHAN RAMLAKHAN NISHAD</dc:creator>
      <pubDate>Sun, 16 Mar 2025 11:45:38 +0000</pubDate>
      <link>https://dev.to/kishan45/how-do-i-find-my-connection-string-in-atlas-48e7</link>
      <guid>https://dev.to/kishan45/how-do-i-find-my-connection-string-in-atlas-48e7</guid>
      <description>&lt;p&gt;To find your MongoDB Atlas connection string, follow these steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Log in to MongoDB Atlas&lt;br&gt;
Go to MongoDB Atlas.&lt;br&gt;
Sign in with your credentials.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select Your Cluster&lt;br&gt;
Click on the Clusters tab.&lt;br&gt;
Select the cluster you want to connect to.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get the Connection String&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on the "Connect" button.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Select "Drivers" or "Connect your application" (if using Node.js).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose Node.js as the driver and select the appropriate version.&lt;br&gt;
Copy the provided connection string (it looks like this):&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mongodb+srv://&amp;lt;username&amp;gt;:&amp;lt;password&amp;gt;@cluster0.xxxxx.mongodb.net/&amp;lt;database&amp;gt;?retryWrites=true&amp;amp;w=majority
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Replace Placeholders&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Replace  with your database username.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Replace  with your database password.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Replace  with the database name you want to connect to.&lt;br&gt;
Example for Node.js (Mongoose)&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const mongoose = require('mongoose');

const uri = "mongodb+srv://yourUser:yourPassword@cluster0.xxxxx.mongodb.net/yourDB?retryWrites=true&amp;amp;w=majority";

mongoose.connect(uri, { useNewUrlParser: true, useUnifiedTopology: true })
    .then(() =&amp;gt; console.log("Connected to MongoDB Atlas"))
    .catch(err =&amp;gt; console.error("Error connecting to MongoDB Atlas:", err));

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>How EventBridge, SQS &amp; Lambda Work Together in Your App?</title>
      <dc:creator>KISHAN RAMLAKHAN NISHAD</dc:creator>
      <pubDate>Wed, 12 Mar 2025 16:41:49 +0000</pubDate>
      <link>https://dev.to/kishan45/how-eventbridge-sqs-lambda-work-together-in-your-app-28f9</link>
      <guid>https://dev.to/kishan45/how-eventbridge-sqs-lambda-work-together-in-your-app-28f9</guid>
      <description>&lt;p&gt;Imagine This Scenario in Your App:&lt;br&gt;
You have 9 microservices, and let’s say you are handling order processing in an e-commerce app.&lt;/p&gt;

&lt;p&gt;🛒 User places an order → Now, multiple things need to happen:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Payment Service needs to charge the user.&lt;/li&gt;
&lt;li&gt;Inventory Service needs to update stock.&lt;/li&gt;
&lt;li&gt;Email Service needs to send a confirmation email.&lt;/li&gt;
&lt;li&gt;Shipping Service needs to prepare the package.
How EventBridge, SQS &amp;amp; Lambda Work Together in Your App?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;🟢 1️⃣ AWS EventBridge (Real-Time Trigger)&lt;/p&gt;

&lt;p&gt;Your Order Service (Node.js microservice) sends an event to EventBridge → "Order Placed".&lt;br&gt;
EventBridge instantly notifies multiple services:&lt;/p&gt;

&lt;p&gt;✅ SQS (for payment processing queue)&lt;br&gt;
✅ Lambda (to send order confirmation email)&lt;br&gt;
✅ Inventory Service (to reduce stock)&lt;/p&gt;

&lt;p&gt;✅ Why? EventBridge is fast and can notify multiple services at once.&lt;/p&gt;

&lt;p&gt;🔵 2️⃣ AWS SQS (Message Queue for Background Tasks)&lt;/p&gt;

&lt;p&gt;The Payment Service picks up the message from SQS and processes the payment.&lt;br&gt;
If the Payment Service is too busy, the message waits in the queue until it’s free.&lt;br&gt;
No order is lost, even if the Payment Service crashes or is slow.&lt;/p&gt;

&lt;p&gt;✅ Why? SQS queues tasks so they are processed one by one, safely.&lt;/p&gt;

&lt;p&gt;🟡 3️⃣ AWS Lambda (For Serverless Tasks)&lt;/p&gt;

&lt;p&gt;EventBridge triggers a Lambda function to send the order confirmation email.&lt;br&gt;
Lambda runs only when needed, so you don’t need a separate Email Service in your microservices.&lt;/p&gt;

&lt;p&gt;✅ Why? Lambda is lightweight, cost-effective, and doesn’t require a dedicated server.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fps5ggz0gvxs2wgb5fouo.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fps5ggz0gvxs2wgb5fouo.png" alt="Image description" width="786" height="182"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;🔥 Why This is Powerful for Your 9 Microservices?&lt;/p&gt;

&lt;p&gt;✔ EventBridge makes microservices communicate efficiently.&lt;br&gt;
✔ SQS ensures tasks are completed even if a service is down.&lt;br&gt;
✔ Lambda runs lightweight background tasks without extra servers.&lt;/p&gt;

&lt;p&gt;Now, your Node.js backend is scalable, reliable, and optimized! 🚀🔥&lt;/p&gt;

&lt;p&gt;Does this explanation make sense now? 😊&lt;/p&gt;

</description>
    </item>
    <item>
      <title>MongoDB Aggregation Pipeline Explained Simply</title>
      <dc:creator>KISHAN RAMLAKHAN NISHAD</dc:creator>
      <pubDate>Mon, 10 Mar 2025 07:26:31 +0000</pubDate>
      <link>https://dev.to/kishan45/mongodb-aggregation-pipeline-explained-simply-2be3</link>
      <guid>https://dev.to/kishan45/mongodb-aggregation-pipeline-explained-simply-2be3</guid>
      <description>&lt;p&gt;MongoDB Aggregation Pipeline Explained Simply&lt;br&gt;
The Aggregation Pipeline is like a step-by-step process to filter, modify, and analyze data in MongoDB. Think of it as an assembly line, where data goes through different stages to get the desired result.&lt;/p&gt;

&lt;p&gt;Each stage in the pipeline modifies or processes the data before passing it to the next stage.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;$match (Filter Documents Like WHERE in SQL)
🔹 Selects only the documents that match a specific condition.
🔹 Similar to SQL's WHERE clause.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example: Get users who live in "New York"&lt;br&gt;
js&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
db.users.aggregate([&lt;br&gt;
  { $match: { city: "New York" } }&lt;br&gt;
])&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;$group (Group Data Like GROUP BY in SQL)
🔹 Groups multiple documents together based on a field.
🔹 Useful for counting, summing, and averaging data.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example: Count users in each city&lt;br&gt;
js&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
db.users.aggregate([&lt;br&gt;
  { $group: { _id: "$city", totalUsers: { $sum: 1 } } }&lt;br&gt;
])&lt;br&gt;
✅ _id → Grouping by city&lt;br&gt;
✅ totalUsers → Counts users in each city&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;$limit (Limit Number of Results)
🔹 Stops processing after a certain number of results.
🔹 Like LIMIT in SQL.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example: Get only the first 3 users&lt;br&gt;
js&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
db.users.aggregate([&lt;br&gt;
  { $limit: 3 }&lt;br&gt;
])&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;$sort (Sort Data Like ORDER BY in SQL)
🔹 Sorts the data in ascending (1) or descending (-1) order.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example: Get users sorted by age (oldest first)&lt;br&gt;
js&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
db.users.aggregate([&lt;br&gt;
  { $sort: { age: -1 } }  // Descending order&lt;br&gt;
])&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;$project (Select Specific Fields Like SELECT in SQL)
🔹 Used to show or hide specific fields.
🔹 Similar to SELECT column_name in SQL.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example: Show only name and age, hide _id&lt;br&gt;
js&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
db.users.aggregate([&lt;br&gt;
  { $project: { name: 1, age: 1, _id: 0 } }&lt;br&gt;
])&lt;br&gt;
✅ 1 → Show field&lt;br&gt;
✅ 0 → Hide field&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;$addFields (Add New Fields or Modify Existing Fields)
🔹 Creates new fields or updates existing ones.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example: Add a new field fullName&lt;br&gt;
js&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
db.users.aggregate([&lt;br&gt;
  { $addFields: { fullName: { $concat: ["$firstName", " ", "$lastName"] } } }&lt;br&gt;
])&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;$count (Count Total Documents)
🔹 Counts the number of documents after filtering.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example: Count users in "New York"&lt;br&gt;
js&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
db.users.aggregate([&lt;br&gt;
  { $match: { city: "New York" } },&lt;br&gt;
  { $count: "totalUsers" }&lt;br&gt;
])&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;$lookup (Join Two Collections Like JOIN in SQL)
🔹 Joins data from another collection (like SQL JOIN).
🔹 Useful when you have related data in different collections.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example: Join users and orders collections&lt;br&gt;
js&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
db.users.aggregate([&lt;br&gt;
  {&lt;br&gt;
    $lookup: {&lt;br&gt;
      from: "orders",          // Collection to join&lt;br&gt;
      localField: "_id",       // Field in users&lt;br&gt;
      foreignField: "userId",  // Matching field in orders&lt;br&gt;
      as: "userOrders"         // New array field with matching orders&lt;br&gt;
    }&lt;br&gt;
  }&lt;br&gt;
])&lt;br&gt;
✅ Finds all orders where userId in orders matches _id in users.&lt;br&gt;
✅ The matching orders are added as an array called "userOrders".&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;$out (Store Results in a New Collection)
🔹 Saves the result of the aggregation into a new collection.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Example: Save user count per city into cityStats collection&lt;br&gt;
js&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
db.users.aggregate([&lt;br&gt;
  { $group: { _id: "$city", totalUsers: { $sum: 1 } } },&lt;br&gt;
  { $out: "cityStats" }&lt;br&gt;
])&lt;br&gt;
✅ Now, a new collection cityStats is created with grouped data.&lt;/p&gt;

&lt;p&gt;Example: Complete Pipeline&lt;br&gt;
Let's say we want to:&lt;br&gt;
1️⃣ Find users older than 25&lt;br&gt;
2️⃣ Group them by city and count them&lt;br&gt;
3️⃣ Sort by the number of users (most to least)&lt;br&gt;
4️⃣ Limit the result to the top 3 cities&lt;/p&gt;

&lt;p&gt;js&lt;br&gt;
Copy&lt;br&gt;
Edit&lt;br&gt;
db.users.aggregate([&lt;br&gt;
  { $match: { age: { $gt: 25 } } },      // Step 1: Filter users&lt;br&gt;
  { $group: { _id: "$city", count: { $sum: 1 } } },  // Step 2: Group by city&lt;br&gt;
  { $sort: { count: -1 } },              // Step 3: Sort by count descending&lt;br&gt;
  { $limit: 3 }                          // Step 4: Limit to top 3&lt;br&gt;
])&lt;br&gt;
Summary Table&lt;br&gt;
Operator    Purpose SQL Equivalent&lt;br&gt;
$match  Filters data    WHERE&lt;br&gt;
$group  Groups data GROUP BY&lt;br&gt;
$limit  Limits results  LIMIT&lt;br&gt;
$sort   Sorts data  ORDER BY&lt;br&gt;
$project    Selects specific fields SELECT column_name&lt;br&gt;
$addFields  Adds/updates fields ALTER TABLE (Not exactly the same)&lt;br&gt;
$count  Counts documents    COUNT(*)&lt;br&gt;
$lookup Joins another collection    JOIN&lt;br&gt;
$out    Saves results in a new collection   INSERT INTO new_table&lt;br&gt;
Final Thoughts&lt;br&gt;
MongoDB Aggregation Pipeline is a powerful tool for analyzing and transforming data. The key is understanding each stage and combining them effectively. 🚀&lt;/p&gt;

&lt;p&gt;&lt;a href="https://chatgpt.com/share/67ce9027-eb30-8005-93c0-aaa2d04d439c" rel="noopener noreferrer"&gt;https://chatgpt.com/share/67ce9027-eb30-8005-93c0-aaa2d04d439c&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>CORRECT LDAP JavaScript</title>
      <dc:creator>KISHAN RAMLAKHAN NISHAD</dc:creator>
      <pubDate>Fri, 28 Feb 2025 11:26:56 +0000</pubDate>
      <link>https://dev.to/kishan45/correct-ldap-javascript-1ofk</link>
      <guid>https://dev.to/kishan45/correct-ldap-javascript-1ofk</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;exports.ldapLogin = async (req, res, next) =&amp;gt; {

  try {

    var uid = '90002346';

var username = `icicibankltd\\${uid}`;

var password = 'Oneplus@7t';

var config = {

  url: 'LDAP://icicibankltd.com:389',

  baseDN: 'DC=icicibankltd,DC=com',

  username,

  password,

};

var ad = new ActiveDirectory(config);

// Authenticate

ad.authenticate(username, password, function (err, auth) {

  if (err) {

    console.log('ERROR: ' + JSON.stringify(err));

    return;

  }

  if (auth) {

    console.log('Authenticated!', auth);

  } else {

    console.log('Authentication failed!');

  }

});

  } catch (error) {

    console.log(error, "25");

    handleError(req, res, error);

  }

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>he distance between two geographical points SQL</title>
      <dc:creator>KISHAN RAMLAKHAN NISHAD</dc:creator>
      <pubDate>Fri, 28 Feb 2025 11:25:29 +0000</pubDate>
      <link>https://dev.to/kishan45/he-distance-between-two-geographical-points-sql-35e</link>
      <guid>https://dev.to/kishan45/he-distance-between-two-geographical-points-sql-35e</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE FUNCTION [dbo].[Distance] 
(
    @lat1 FLOAT, 
    @long1 FLOAT, 
    @lat2 FLOAT, 
    @long2 FLOAT
) 
RETURNS FLOAT
AS
BEGIN
    DECLARE @DegToRad FLOAT = 57.29577951;
    DECLARE @Ans FLOAT = 0;
    DECLARE @Miles FLOAT = 0;

    -- If any input is null or 0, return 0 distance
    IF @lat1 IS NULL OR @lat1 = 0 
        OR @long1 IS NULL OR @long1 = 0 
        OR @lat2 IS NULL OR @lat2 = 0 
        OR @long2 IS NULL OR @long2 = 0
    BEGIN
        RETURN 0; -- No distance when coordinates are invalid
    END

    -- Calculate the Haversine distance
    SET @Ans = SIN(@lat1 / @DegToRad) * SIN(@lat2 / @DegToRad) 
             + COS(@lat1 / @DegToRad) * COS(@lat2 / @DegToRad) * COS(ABS(@long2 - @long1) / @DegToRad);

    -- Compute distance in miles
    SET @Miles = 3959 * ATAN(SQRT(1 - SQUARE(@Ans)) / @Ans);

    -- Convert miles to kilometers and then to meters
    RETURN @Miles * 1.60934 * 1000;
END
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>handleBase64Upload</title>
      <dc:creator>KISHAN RAMLAKHAN NISHAD</dc:creator>
      <pubDate>Fri, 28 Feb 2025 11:23:37 +0000</pubDate>
      <link>https://dev.to/kishan45/handlebase64upload-54k1</link>
      <guid>https://dev.to/kishan45/handlebase64upload-54k1</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const rp = require('request-promise');

const baseUrl = "https://uotmnewuat.icicibank.com/UOTM_data/api/upload";

const handleBase64Upload = (folder) =&amp;gt; {
  return async (req, res, next) =&amp;gt; {
    try {
      if (req.body.thumbmail) {
        console.log("Processing Base64 image");

        let fileType;
        let base64Data = req.body.thumbmail;

        // Check if the Base64 string has a prefix
        const matches = base64Data.match(/^data:(.+);base64,(.+)$/);
        if (matches &amp;amp;&amp;amp; matches.length === 3) {
          const mimeType = matches[1]; // Extract MIME type (e.g., image/jpeg)
          fileType = mimeType.split('/')[1]; // Extract file extension (e.g., jpeg, png)
          base64Data = matches[2]; // Extract Base64 content
        } else {
          throw new Error("Invalid Base64 format. Missing data URI prefix.");
        }

        // Prepare the file for upload
        const fileBuffer = Buffer.from(base64Data, 'base64');
        const fileName = `thumbmail_${Date.now()}.${fileType}`;

        // Upload the file to Azure
        const options = {
          uri: baseUrl,
          method: 'POST',
          formData: {
            folder,
            image: {
              value: fileBuffer,
              options: {
                filename: fileName,
                contentType: `image/${fileType}`
              }
            }
          },
          json: true
        };

        const response = await rp(options);

        if (response.StatusCode === 100) {
          console.log("File uploaded successfully:", response.Data);
          req.body.thumbmail = response.Data; // Update request body with the Azure URL
        } else {
          throw new Error(response.Message || "Failed to upload file to Azure");
        }
      }

      next();
    } catch (error) {
      console.error("Error handling Base64 upload:", error.message);
      res.status(400).json({ message: 'Failed to process and upload Base64 image', error: error.message });
    }
  };
};

module.exports = handleBase64Upload;

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>production-level Node.js project for a simple note-taking application</title>
      <dc:creator>KISHAN RAMLAKHAN NISHAD</dc:creator>
      <pubDate>Sat, 22 Feb 2025 16:06:33 +0000</pubDate>
      <link>https://dev.to/kishan45/production-level-nodejs-project-for-a-simple-note-taking-application-1ghi</link>
      <guid>https://dev.to/kishan45/production-level-nodejs-project-for-a-simple-note-taking-application-1ghi</guid>
      <description>&lt;p&gt;Below is an example of a production-level Node.js project for a simple note-taking application, along with its source code structure.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;├── package.json
├── server.js
├── routes
│   └── notes.js
├── controllers
│   └── notesController.js
├── models
│   └── note.js
├── services
│   └── noteService.js
├── config
│   └── db.js
└── test
    └── notes.test.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;package.json: Defines project dependencies and scripts.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    {
      "name": "note-taking-app",
      "version": "1.0.0",
      "description": "Simple note-taking application",
      "main": "server.js",
      "scripts": {
        "start": "node server.js",
        "dev": "nodemon server.js",
        "test": "jest --watchAll --coverage"
      },
      "dependencies": {
        "express": "^4.17.1",
        "mongoose": "^6.0.12",
        "dotenv": "^10.0.0",
        "jest": "^27.3.1",
        "supertest": "^6.1.6"
      },
      "devDependencies": {
        "nodemon": "^2.0.15"
      }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;server.js: Main entry point of the application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    // server.js
    const express = require('express');
    const mongoose = require('mongoose');
    const dotenv = require('dotenv');
    const routes = require('./routes/notes');
    const app = express();
    dotenv.config();

    // Middleware to parse JSON request bodies
    app.use(express.json());

    // Routes
    app.use('/api/notes', routes);

    const start = async () =&amp;gt; {
      try {
        await mongoose.connect(process.env.MONGO_URI);
        app.listen(process.env.PORT, () =&amp;gt; console.log(`Server started on port ${process.env.PORT}`));
      } catch (error) {
        console.error(error);
        process.exit(1);
      }
    };

    start();
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;routes/notes.js: Defines API endpoints for notes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    // routes/notes.js
    const express = require('express');
    const router = express.Router();
    const notesController = require('../controllers/notesController');

    router.get('/', notesController.getAllNotes);
    router.post('/', notesController.createNote);
    router.get('/:id', notesController.getNoteById);
    router.put('/:id', notesController.updateNote);
    router.delete('/:id', notesController.deleteNote);

    module.exports = router;


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

&lt;/div&gt;



&lt;p&gt;controllers/notesController.js: Handles request logic.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    // controllers/notesController.js
    const noteService = require('../services/noteService');

    const getAllNotes = async (req, res) =&amp;gt; {
      try {
        const notes = await noteService.getAllNotes();
        res.json(notes);
      } catch (error) {
        res.status(500).json({ message: error.message });
      }
    };

    const createNote = async (req, res) =&amp;gt; {
        try {
            const newNote = await noteService.createNote(req.body);
            res.status(201).json(newNote);
        } catch (error) {
            res.status(500).json({ message: error.message });
        }
    };

    const getNoteById = async (req, res) =&amp;gt; {
        try {
            const note = await noteService.getNoteById(req.params.id);
            if (!note) {
                return res.status(404).json({ message: 'Note not found' });
            }
            res.json(note);
        } catch (error) {
            res.status(500).json({ message: error.message });
        }
    };

    const updateNote = async (req, res) =&amp;gt; {
        try {
            const updatedNote = await noteService.updateNote(req.params.id, req.body);
            if (!updatedNote) {
                return res.status(404).json({ message: 'Note not found' });
            }
            res.json(updatedNote);
        } catch (error) {
            res.status(500).json({ message: error.message });
        }
    };

    const deleteNote = async (req, res) =&amp;gt; {
        try {
            const result = await noteService.deleteNote(req.params.id);
            if (!result) {
                return res.status(404).json({ message: 'Note not found' });
            }
            res.status(204).send();
        } catch (error) {
            res.status(500).json({ message: error.message });
        }
    };

    module.exports = {
        getAllNotes,
        createNote,
        getNoteById,
        updateNote,
        deleteNote,
    };    
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;models/note.js: Defines the note schema using Mongoose.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    // models/note.js
    const mongoose = require('mongoose');

    const noteSchema = new mongoose.Schema({
      title: {
        type: String,
        required: true
      },
      content: {
        type: String,
        required: true
      },
      createdAt: {
        type: Date,
        default: Date.now
      },
      updatedAt: {
        type: Date,
        default: Date.now
      }
    });

    module.exports = mongoose.model('Note', noteSchema);
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;services/noteService.js: Business logic for notes&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    // services/noteService.js
    const Note = require('../models/note');

    const getAllNotes = async () =&amp;gt; {
      return await Note.find();
    };

    const createNote = async (noteData) =&amp;gt; {
        const note = new Note(noteData);
        return await note.save();
    };

    const getNoteById = async (id) =&amp;gt; {
        return await Note.findById(id);
    };

    const updateNote = async (id, noteData) =&amp;gt; {
        return await Note.findByIdAndUpdate(id, noteData, { new: true });
    };

    const deleteNote = async (id) =&amp;gt; {
        return await Note.findByIdAndDelete(id);
    };

    module.exports = {
        getAllNotes,
        createNote,
        getNoteById,
        updateNote,
        deleteNote,
    };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;config/db.js: Configuration for MongoDB connection.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    // config/db.js
    const mongoose = require('mongoose');

    const connectDB = async () =&amp;gt; {
      try {
        await mongoose.connect(process.env.MONGO_URI, {
          useNewUrlParser: true,
          useUnifiedTopology: true,
          useCreateIndex: true,
          useFindAndModify: false
        });
        console.log('MongoDB connected');
      } catch (error) {
        console.error('MongoDB connection error:', error);
        process.exit(1);
      }
    };

    module.exports = connectDB;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Building a production-level Node.js project involves several key</title>
      <dc:creator>KISHAN RAMLAKHAN NISHAD</dc:creator>
      <pubDate>Sat, 22 Feb 2025 15:35:19 +0000</pubDate>
      <link>https://dev.to/kishan45/building-a-production-level-nodejs-project-involves-several-key-2adc</link>
      <guid>https://dev.to/kishan45/building-a-production-level-nodejs-project-involves-several-key-2adc</guid>
      <description>&lt;p&gt;Building a production-level Node.js project involves several key considerations to ensure reliability, scalability, and maintainability. Here's a breakdown of essential steps and best practices:&lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Project Setup and Structure:&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Initialize a new project using npm init or yarn init.&lt;/li&gt;
&lt;li&gt;Organize code into modules using a clear directory structure (e.g., src/controllers, src/models, src/routes, src/services).&lt;/li&gt;
&lt;li&gt;Use a version control system like Git for code management.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;Framework Selection:&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose a framework like Express.js for building web applications or APIs.&lt;/li&gt;
&lt;li&gt;Consider NestJS for more structured and scalable applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;Dependency Management:&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use npm or yarn to manage project dependencies.&lt;/li&gt;
&lt;li&gt;Specify exact versions for dependencies in package.json to avoid compatibility issues.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;Configuration Management:&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use environment variables to store sensitive information and configuration settings.&lt;/li&gt;
&lt;li&gt;Utilize a library like dotenv to manage environment variables in development.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;Database Integration:&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose a suitable database (e.g., PostgreSQL, MongoDB, MySQL).&lt;/li&gt;
&lt;li&gt;Use an ORM or ODM (e.g., Sequelize, Mongoose) for database interaction.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;Authentication and Authorization:&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Implement secure authentication mechanisms (e.g., JWT, OAuth).&lt;/li&gt;
&lt;li&gt;Use middleware for authorization and access control.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;7Logging and Error Handling:&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Implement robust logging using a library like Winston or Morgan.&lt;/li&gt;
&lt;li&gt;Handle errors gracefully with centralized error handling middleware.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;Testing:&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write unit tests, integration tests, and end-to-end tests using frameworks like Jest or Mocha.&lt;/li&gt;
&lt;li&gt;Implement continuous integration (CI) to automate testing.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;Security:&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Protect against common web vulnerabilities (e.g., XSS, CSRF, SQL injection).&lt;/li&gt;
&lt;li&gt;Use HTTPS for secure communication.&lt;/li&gt;
&lt;li&gt;Regularly update dependencies to patch security vulnerabilities.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;Performance Optimization:&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use a process manager like PM2 or nodemon for production deployments.&lt;/li&gt;
&lt;li&gt;Implement caching mechanisms (e.g., Redis, Memcached).&lt;/li&gt;
&lt;li&gt;Monitor application performance using tools like New Relic or Datadog.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;Deployment:&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Choose a hosting platform (e.g., AWS, Google Cloud, Heroku).&lt;/li&gt;
&lt;li&gt;Automate deployments using tools like Docker and CI/CD pipelines.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;Documentation:&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Write clear and comprehensive documentation for the API and application.&lt;/li&gt;
&lt;li&gt;Use tools like Swagger or JSDoc to generate API documentation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;*&lt;em&gt;Monitoring and Maintenance:&lt;br&gt;
*&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set up monitoring and alerting for production systems.&lt;/li&gt;
&lt;li&gt;Regularly review logs and performance metrics.&lt;/li&gt;
&lt;li&gt;Plan for ongoing maintenance and updates&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
