<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-1055866655041959795</id><updated>2026-01-04T10:40:42.108+05:30</updated><category term="MongoDB"/><category term="EXT JS 3.x"/><category term="Javascript"/><category term="React JS"/><category term="Ionic 1.3"/><category term="Jquery"/><category term="Laptops"/><category term="AngularJS"/><category term="Ionic Framework"/><category term="UnitTesting"/><category term="Android Apps"/><category term="EXT JS 2.x"/><category term="EXT JS 4.x"/><category term="GULP"/><category term="Google"/><category term="HSQLDB"/><category term="IOS app"/><category term="JEST"/><category term="Jquery UI"/><category term="Mobile"/><category term="Objective-C"/><category term="Primefaces"/><category term="React Native"/><category term="Software Development Principle"/><category term="backbonejs"/><category term="bonita"/><category term="Android4"/><category term="Browser"/><category term="Cordova"/><category term="Custom table in Powerapps"/><category term="Datatable"/><category term="Eclipse"/><category term="Eclipse Kepler"/><category term="GIT"/><category term="HTML5"/><category term="IOS Bridging"/><category term="IOS Notifications"/><category term="Iphone"/><category term="Istanbul"/><category term="JSF"/><category term="Java"/><category term="Java Design Patterns"/><category term="Java Design Patterns Mock Questions"/><category term="JqGrid"/><category term="MongpDB Topics"/><category term="Post Solution"/><category term="PowerApps"/><category term="PrimeReact"/><category term="SpringBoot"/><category term="Tablet Tweaks"/><category term="Tinymce"/><category term="Tomcat"/><category term="Tomee"/><category term="Windows"/><category term="Windows OS"/><category term="Windows product Key"/><category term="earn money online"/><category term="macromedia"/><title type='text'>TechHeap</title><subtitle type='html'>Tutorials and examples on various frameworks and web development</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>88</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-826142409192519205</id><published>2025-05-09T11:57:00.003+05:30</published><updated>2025-05-09T11:58:01.597+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Custom table in Powerapps"/><category scheme="http://www.blogger.com/atom/ns#" term="PowerApps"/><title type='text'>How to create a custom table in Microsoft Power apps</title><content type='html'>&lt;p&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&amp;nbsp;Below are the steps to create custom tables in Power Apps&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;background-color: white;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; font-family: Inter, &amp;quot;Inter Fallback&amp;quot;; margin: 0px;&quot;&gt;&lt;span class=&quot;font-semibold&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: white; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; font-weight: 600;&quot;&gt;Step 1: Create a new table&lt;/span&gt;&lt;/p&gt;&lt;ol class=&quot;ml-4 list-outside list-decimal&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; font-family: Inter, &amp;quot;Inter Fallback&amp;quot;; list-style-image: initial; list-style-position: outside; margin: 0px 0px 0px 1rem; padding: 0px;&quot;&gt;&lt;li class=&quot;py-1&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; padding-bottom: 0.25rem; padding-top: 0.25rem;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Open PowerApps and navigate to the &quot;Table&quot; menu in left panel.&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;py-1&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; padding-bottom: 0.25rem; padding-top: 0.25rem;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Click on the &quot;Start with a black table&quot; button.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; font-family: Inter, &amp;quot;Inter Fallback&amp;quot;; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8spmVlXpRsl8ha3jSGzLVA0X9vndE6ljPTxgRPnvjwhxS90odXCAzoNw4QRNiO-QkVqmgdyPjYDsr6AHtc6OjhWT1CIHIrVhJh0ig-_aJxXeAVCDOwuET69tFrvnDyBNXJrW09pydkZI6qPC_kcTCBUkBJeWZi-ep8E6Fh-l5O7Y1-pbuUiTDOb73YNxY/s2031/Screenshot%202025-05-08%20at%209.54.29%E2%80%AFAM.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;create custom table&quot; border=&quot;0&quot; data-original-height=&quot;509&quot; data-original-width=&quot;2031&quot; height=&quot;100&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8spmVlXpRsl8ha3jSGzLVA0X9vndE6ljPTxgRPnvjwhxS90odXCAzoNw4QRNiO-QkVqmgdyPjYDsr6AHtc6OjhWT1CIHIrVhJh0ig-_aJxXeAVCDOwuET69tFrvnDyBNXJrW09pydkZI6qPC_kcTCBUkBJeWZi-ep8E6Fh-l5O7Y1-pbuUiTDOb73YNxY/w400-h100/Screenshot%202025-05-08%20at%209.54.29%E2%80%AFAM.png&quot; title=&quot;Custom Table&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;background-color: white; font-family: Inter, &amp;quot;Inter Fallback&amp;quot;;&quot;&gt;&lt;div&gt;&lt;span style=&quot;background-color: white; font-family: Inter, &amp;quot;Inter Fallback&amp;quot;;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;3. Enter a name for your table and click &quot;Create&quot;.&lt;/span&gt;&lt;div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-0kXgyZb0pX4FTMH0_WykkNa8CELrE1cvi095iWAgb-asbRIPWC7YfSO8qLPZUmDQT5dLkxhdw4NfMJ5ge3odHU9Ip2Qe14kZ7s5GRGHb409vTudhxgKDtbqsoPko2r-MqW9-n9L5sNrqnHJgj9olubfPCT_P306NM5jwbKkHHXgyziotWmbN4ObXU12q/s1729/Screenshot%202025-05-08%20at%209.57.32%E2%80%AFAM.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;Add Table Name&quot; border=&quot;0&quot; data-original-height=&quot;707&quot; data-original-width=&quot;1729&quot; height=&quot;164&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj-0kXgyZb0pX4FTMH0_WykkNa8CELrE1cvi095iWAgb-asbRIPWC7YfSO8qLPZUmDQT5dLkxhdw4NfMJ5ge3odHU9Ip2Qe14kZ7s5GRGHb409vTudhxgKDtbqsoPko2r-MqW9-n9L5sNrqnHJgj9olubfPCT_P306NM5jwbKkHHXgyziotWmbN4ObXU12q/w400-h164/Screenshot%202025-05-08%20at%209.57.32%E2%80%AFAM.png&quot; title=&quot;Table Name&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style=&quot;font-family: Inter, Inter Fallback;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;div&gt;&lt;span style=&quot;font-family: Inter, Inter Fallback;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; font-family: Inter, &amp;quot;Inter Fallback&amp;quot;; margin: 0px;&quot;&gt;&lt;span class=&quot;font-semibold&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: white; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; font-weight: 600;&quot;&gt;Step 2: Define the table structure&lt;/span&gt;&lt;/p&gt;&lt;ol class=&quot;ml-4 list-outside list-decimal&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; font-family: Inter, &amp;quot;Inter Fallback&amp;quot;; list-style-image: initial; list-style-position: outside; margin: 0px 0px 0px 1rem; padding: 0px;&quot;&gt;&lt;li class=&quot;py-1&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; padding-bottom: 0.25rem; padding-top: 0.25rem;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;In the &quot;Table&quot; tab, click on the &quot;Add column&quot; button.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN9nFz5BVYjyeW24dLMY1rTAALvwS53wVh-HZ75_Ql-2_f46Xew8ah0H0bPNfDdiMPbYh7SjYFcCGkrhd0djm1zNVCovlkXfWkjU4tac6ezmcg7-aZKnAA5r1Yq1RYDGge7MDiYt2VipD2x4lYI555YmBwueBkSyTYxyetZZiPuY2zlACGHthEIoFz2YJY/s824/Screenshot%202025-05-08%20at%209.56.15%E2%80%AFAM.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;add or edit column&quot; border=&quot;0&quot; data-original-height=&quot;731&quot; data-original-width=&quot;824&quot; height=&quot;355&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN9nFz5BVYjyeW24dLMY1rTAALvwS53wVh-HZ75_Ql-2_f46Xew8ah0H0bPNfDdiMPbYh7SjYFcCGkrhd0djm1zNVCovlkXfWkjU4tac6ezmcg7-aZKnAA5r1Yq1RYDGge7MDiYt2VipD2x4lYI555YmBwueBkSyTYxyetZZiPuY2zlACGHthEIoFz2YJY/w400-h355/Screenshot%202025-05-08%20at%209.56.15%E2%80%AFAM.png&quot; title=&quot;Add or Edit column&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;py-1&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; padding-bottom: 0.25rem; padding-top: 0.25rem;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Enter the name and data type for each column (e.g. text, number, date, etc.).&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;py-1&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; padding-bottom: 0.25rem; padding-top: 0.25rem;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Repeat this process for each column you want to add.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; font-family: Inter, &amp;quot;Inter Fallback&amp;quot;; margin: 0px;&quot;&gt;&lt;span class=&quot;font-semibold&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; background-color: white; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; font-weight: 600;&quot;&gt;Step 3: Add data to the table&lt;/span&gt;&lt;/p&gt;&lt;ol class=&quot;ml-4 list-outside list-decimal&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; font-family: Inter, &amp;quot;Inter Fallback&amp;quot;; list-style-image: initial; list-style-position: outside; margin: 0px 0px 0px 1rem; padding: 0px;&quot;&gt;&lt;li class=&quot;py-1&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; padding-bottom: 0.25rem; padding-top: 0.25rem;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Click on the &quot;Table&quot; menu in Left Panel.&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;py-1&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; padding-bottom: 0.25rem; padding-top: 0.25rem;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Click on the &quot;table name&quot; from the list.&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;py-1&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; padding-bottom: 0.25rem; padding-top: 0.25rem;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;It will show the table properties along with data.&amp;nbsp;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirHZG5pt8sWvzcb2CWR222xHN_2-CT9OjFKxrB3X0ArVcvS03T6lvpFYj4whrBcJcGxOnf6QqcyrsM0ZusrKuRH4u7OnAJxg8F9ZGKsjnKoQd7IcjXdgqut1iWMFVRmdy3AieSM0XW1TJNWp_QEaCF0wX-62Vg3OIx9P_hJFoQxn2GQ7SNkrMP8kg-Q64a/s1265/Screenshot%202025-05-09%20at%2011.53.21%E2%80%AFAM.png&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;add data into table&quot; border=&quot;0&quot; data-original-height=&quot;760&quot; data-original-width=&quot;1265&quot; height=&quot;240&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirHZG5pt8sWvzcb2CWR222xHN_2-CT9OjFKxrB3X0ArVcvS03T6lvpFYj4whrBcJcGxOnf6QqcyrsM0ZusrKuRH4u7OnAJxg8F9ZGKsjnKoQd7IcjXdgqut1iWMFVRmdy3AieSM0XW1TJNWp_QEaCF0wX-62Vg3OIx9P_hJFoQxn2GQ7SNkrMP8kg-Q64a/w400-h240/Screenshot%202025-05-09%20at%2011.53.21%E2%80%AFAM.png&quot; title=&quot;Table structure&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style=&quot;background-color: white; font-family: Inter, &amp;quot;Inter Fallback&amp;quot;; font-weight: 600;&quot;&gt;Step&lt;/span&gt;&lt;span style=&quot;background-color: white; font-family: Inter, &amp;quot;Inter Fallback&amp;quot;; font-weight: 600;&quot;&gt;&amp;nbsp;4 Save and publish the table&lt;/span&gt;&lt;br /&gt;&lt;ol class=&quot;ml-4 list-outside list-decimal&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; font-family: Inter, &amp;quot;Inter Fallback&amp;quot;; list-style-image: initial; list-style-position: outside; margin: 0px 0px 0px 1rem; padding: 0px;&quot;&gt;&lt;li class=&quot;py-1&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; padding-bottom: 0.25rem; padding-top: 0.25rem;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Click on the &quot;Save&quot; button to save your table.&lt;/span&gt;&lt;/li&gt;&lt;li class=&quot;py-1&quot; style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; padding-bottom: 0.25rem; padding-top: 0.25rem;&quot;&gt;&lt;span style=&quot;background-color: white;&quot;&gt;Click on the &quot;Publish&quot; button to publish your table to the PowerApps platform.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;p style=&quot;--tw-border-spacing-x: 0; --tw-border-spacing-y: 0; --tw-ring-color: rgb(59 130 246/0.5); --tw-ring-offset-color: #fff; --tw-ring-offset-shadow: 0 0 #0000; --tw-ring-offset-width: 0px; --tw-ring-shadow: 0 0 #0000; --tw-rotate: 0; --tw-scale-x: 1; --tw-scale-y: 1; --tw-scroll-snap-strictness: proximity; --tw-shadow-colored: 0 0 #0000; --tw-shadow: 0 0 #0000; --tw-skew-x: 0; --tw-skew-y: 0; --tw-translate-x: 0; --tw-translate-y: 0; border-color: hsl(var(--border)); border-image: initial; border-style: solid; border-width: 0px; box-sizing: border-box; font-family: Inter, &amp;quot;Inter Fallback&amp;quot;; margin: 0px;&quot;&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/826142409192519205/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2025/05/how-to-create-custom-table-in-microsoft.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/826142409192519205'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/826142409192519205'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2025/05/how-to-create-custom-table-in-microsoft.html' title='How to create a custom table in Microsoft Power apps'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8spmVlXpRsl8ha3jSGzLVA0X9vndE6ljPTxgRPnvjwhxS90odXCAzoNw4QRNiO-QkVqmgdyPjYDsr6AHtc6OjhWT1CIHIrVhJh0ig-_aJxXeAVCDOwuET69tFrvnDyBNXJrW09pydkZI6qPC_kcTCBUkBJeWZi-ep8E6Fh-l5O7Y1-pbuUiTDOb73YNxY/s72-w400-h100-c/Screenshot%202025-05-08%20at%209.54.29%E2%80%AFAM.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-3488288357019611340</id><published>2022-08-26T21:48:00.006+05:30</published><updated>2022-08-26T21:48:58.405+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="React JS"/><title type='text'>Mutiple ways to programmatically navigate using React router</title><content type='html'>&lt;p&gt;&amp;nbsp;Mutliple ways to navigate between pages in react using react router.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;React Router v6&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;useNavigate hook can be used.&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
  import { useNavigate } from &quot;react-router-dom&quot;
  const Component = () =&amp;gt; {
  &lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;let navigate = useNavigate();
  &lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;navigate(&quot;/pathname&quot;, state: { someData }); 
  }
&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;

&lt;/div&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;React Router v5&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp; useHistory hook can be used.&lt;/span&gt;

    &lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; 
  import { useHistory } from &quot;react-router-dom&quot;
  const Component = () =&amp;gt; {
  &lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;let history = useHistory();
  &lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;history.push(&quot;/pathname&quot;); 
  }
&lt;/code&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/3488288357019611340/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2022/08/mutiple-ways-to-programmatically.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/3488288357019611340'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/3488288357019611340'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2022/08/mutiple-ways-to-programmatically.html' title='Mutiple ways to programmatically navigate using React router'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-2377514504615448395</id><published>2021-06-24T13:20:00.001+05:30</published><updated>2021-06-24T13:20:13.618+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="React JS"/><title type='text'>React JS Interview Questions and topics</title><content type='html'>&lt;p&gt;&amp;nbsp;To evaluate a candidate, recruiters generally asks certain questions so that they can know how much the candidate has hands-on experience and how much is his/her technical capabilities. Below are some of the questions:&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;What is Virtual DOM?&lt;/li&gt;&lt;li&gt;Explain how React Routing works?&lt;/li&gt;&lt;li&gt;What are the ways to debug React JS application?&lt;/li&gt;&lt;li&gt;What are the libraries needed for unit testing. Write a sample unit test.&lt;/li&gt;&lt;li&gt;How to configure application so that whenever an user commits code, it first checks the code alignments and other lint issues and fix them automatically.&lt;/li&gt;&lt;li&gt;How to configure application so that whenever user pushes code to source control, it first run all unit test cases and on success only it pushes the code to the repo&lt;/li&gt;&lt;li&gt;What is Responsize web design?&lt;/li&gt;&lt;li&gt;How does Exception Handling works,&lt;/li&gt;&lt;li&gt;What type of configuration needed to deploy an react application on mulitple environments.&lt;/li&gt;&lt;li&gt;How to maintain configuration data like API URLs, API Keys etc based on different environments in application.&lt;/li&gt;&lt;li&gt;Difference between const and let. Write an example.&lt;/li&gt;&lt;li&gt;Difference between == and ===, write an example.&lt;/li&gt;&lt;li&gt;what is use of pre commit and post commit in package.json?&lt;/li&gt;&lt;li&gt;Difference between ES6 functions like filter and find.&lt;/li&gt;&lt;li&gt;How to configure redux in the application.&lt;/li&gt;&lt;li&gt;How to access lifecycle methods in functional components.&lt;/li&gt;&lt;li&gt;Which lifecycle methods we can access using useEffect hook.&lt;/li&gt;&lt;li&gt;How and where we can use Spread Operator?&lt;/li&gt;&lt;li&gt;What is the use of JWT token and how does it works.&lt;/li&gt;&lt;li&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/2377514504615448395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2021/06/react-js-interview-questions-and-topics.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/2377514504615448395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/2377514504615448395'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2021/06/react-js-interview-questions-and-topics.html' title='React JS Interview Questions and topics'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-9022589662379265269</id><published>2021-06-18T10:44:00.007+05:30</published><updated>2021-06-18T10:55:22.442+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB"/><title type='text'>How to query like joins on 2 collections in mongodb using aggregate keyword</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
To query like JOINS between 2 collections in mongodb, we need to use $aggregate.&lt;br /&gt;
&lt;br /&gt;
Lets see the example:&lt;/div&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&amp;nbsp;
&lt;br /&gt;I have 2 collections, one is Employee and another one is Department.&lt;br /&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt; Employee Collection  
           {    
             &quot;_id&quot; : 1,    
             &quot;name&quot; : {    
                &quot;first&quot; : &quot;Abhi&quot;,    
                &quot;last&quot; : &quot;Dev&quot;    
             },    
             &quot;departmentId&quot; : 2
            },    
            {    
             &quot;_id&quot; : 2,    
             &quot;name&quot; : {    
                &quot;first&quot; : &quot;Abc&quot;,    
                &quot;last&quot; : &quot;Agrawal&quot;    
             },    
          &lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&quot;departmentId&quot; : 1 
            },    
            {    
             &quot;_id&quot; : 3,    
             &quot;name&quot; : {    
                &quot;first&quot; : &quot;Dhruv&quot;,    
                &quot;last&quot; : &quot;Agrawal&quot;    
             },    
             &quot;departmentId&quot; : 1,    
            }  
           }   

&lt;pre style=&quot;background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial; background-repeat: initial; background-size: initial; border: 1px dashed rgb(204, 204, 204); font-family: arial; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 677.156px;&quot;&gt;&lt;code style=&quot;overflow-wrap: normal; word-wrap: normal;&quot;&gt;Department Collection  
           {    
             &quot;_id&quot; : 1,    
             &quot;name&quot; : &quot;finance&quot; 
            },    
            {    
             &quot;_id&quot; : 2,    
             &quot;name&quot; : &quot;hr&quot; 
            }
           } &lt;/code&gt;&lt;/pre&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Now I need to fetch employee details for id 2 along with employee&#39;s department name.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
The query would be:&lt;br /&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); color: black; font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; overflow-wrap: normal; word-wrap: normal;&quot;&gt;
db.employee
    .aggregate([
      { $match: { _id: 2 } },
      {
        $lookup: {
          localField: &#39;departmentId&#39;,
          from: &#39;department&#39;,
          foreignField: &#39;_id&#39;,
          as: &#39;departmentName&#39;,
        },
      },
      { $unwind: &#39;$departmentName&#39; }&lt;br /&gt;    ]).toArray()
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
The output would be:&lt;br /&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.469px;&quot;&gt;&lt;code style=&quot;overflow-wrap: normal; word-wrap: normal;&quot;&gt;
	{    
         &quot;_id&quot; : 2,    
         &quot;name&quot; : {    
         	&quot;first&quot; : &quot;Abc&quot;,    
         	&quot;last&quot; : &quot;Agrawal&quot;    
         },
         &quot;departmentName&quot;: {
            &quot;name&quot;: &quot;finance&quot;
         }
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hope it helps.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/9022589662379265269/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2021/06/query-like-joins-on-collections.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/9022589662379265269'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/9022589662379265269'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2021/06/query-like-joins-on-collections.html' title='How to query like joins on 2 collections in mongodb using aggregate keyword'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-903953866253010642</id><published>2019-10-30T16:15:00.001+05:30</published><updated>2019-10-30T16:15:57.985+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="JEST"/><category scheme="http://www.blogger.com/atom/ns#" term="React JS"/><category scheme="http://www.blogger.com/atom/ns#" term="UnitTesting"/><title type='text'>How to mock third party libraries and functions in jest using react js</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Jest is a library we use for testing JS code whether it&#39;s an Angular application or React JS.&lt;br /&gt;
&lt;br /&gt;
Many times we encounter issues while testing code which has third party libraries like mixpanel, moment, redux etc.&lt;br /&gt;
&lt;br /&gt;
To resolve, we need to mock these 3rd party libraries and their respective functions. We need to intercept these libraries by mocking as given below:&lt;br /&gt;
&lt;br /&gt;
1) Create a directory at root as &lt;b&gt;&quot;__mocks__&quot;&lt;/b&gt;.&lt;br /&gt;
2) Let say we need to create mock for &lt;b&gt;moment&lt;/b&gt; library. Create a JS file under __mocks__ as &lt;b&gt;moment.js&lt;/b&gt;. Keep in mind to have the file name exactly same as declared when importing in source code.&lt;br /&gt;
3) Open moment.js file and write below code snippet&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;const moment = {
  anyFunc: jest.fn()
}
export default moment;
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
4) Now execute your jest test cases. It will not throw error for moment library.&lt;br /&gt;
5) Use can add any mock functions in that file and add expected response and test them.&lt;br /&gt;
&lt;br /&gt;
Hope this helps!&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/903953866253010642/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2019/10/how-to-mock-third-party-libraries-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/903953866253010642'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/903953866253010642'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2019/10/how-to-mock-third-party-libraries-and.html' title='How to mock third party libraries and functions in jest using react js'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-6739102269893734034</id><published>2019-07-23T17:06:00.003+05:30</published><updated>2021-06-24T13:22:18.238+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Datatable"/><category scheme="http://www.blogger.com/atom/ns#" term="PrimeReact"/><category scheme="http://www.blogger.com/atom/ns#" term="React JS"/><title type='text'>How to add a checkbox in primereact datatable</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Code snippet to add a checkbox in each row of a primereact datatable.&lt;br /&gt;
&lt;br /&gt;
&lt;div&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;import React, { Component } from &#39;react&#39;;
import {DataTable} from &#39;primereact/datatable&#39;;
import {Column} from &#39;primereact/column&#39;;

export class DTColumnCheckBoxDemo extends Component {

    constructor() {
        super();
        this.state = {
        }
    }
    render() {
       return (
         &amp;lt;DataTable value={this.state.list}}
            selection={this.state.listItem} onSelectionChange={(e) =&amp;gt; this.setState({listItem: e.data})} &amp;gt;
            &amp;lt;Column em=&quot;&quot; selectionmode=&quot;multiple&quot; /&amp;gt;
            &amp;lt;Column field=&quot;xyz&quot; header=&quot;XYZ&quot; /&amp;gt;
            &amp;lt;Column field=&quot;abc&quot; header=&quot;ABC&quot; /&amp;gt;
         &amp;lt;/DataTable&amp;gt;
    );
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
In Column tag we need to add selectionmode&amp;nbsp; attribute to add checkbox in datatable.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/6739102269893734034/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2019/07/how-to-add-checkbox-in-primereact.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/6739102269893734034'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/6739102269893734034'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2019/07/how-to-add-checkbox-in-primereact.html' title='How to add a checkbox in primereact datatable'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-27506564505195122</id><published>2019-07-05T13:08:00.004+05:30</published><updated>2021-06-24T13:23:08.590+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="React JS"/><category scheme="http://www.blogger.com/atom/ns#" term="SpringBoot"/><title type='text'>How to host React JS code with Spring Boot Application</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Sometimes we got a requirement where we need to configure react application so that it can be serve in Spring Boot Application. Means, both Spring boot application and react js code can be served from same server.&lt;br /&gt;
&lt;br /&gt;
Following are the steps we need to follow to make it happen:&lt;br /&gt;
&lt;ol style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;Put all of your &lt;b&gt;html, js, css, etc.&lt;/b&gt; files to &lt;b&gt;src/main/resources/static&lt;/b&gt;. Under &lt;b&gt;resources&lt;/b&gt; folder create a static folder and under it paste all your frontend code.&amp;nbsp;&lt;/li&gt;
&lt;li&gt;Add one ResourceResolver Class to Spring as below:
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;
@Configuration
public class Config implements WebMvcConfigurerAdapter {

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        ResourceResolver resolver = new ReactResourceResolver();
        registry.addResourceHandler(&quot;/**&quot;)
                .resourceChain(true)
                .addResolver(resolver);
    }

    public class ReactResourceResolver implements ResourceResolver {
        // root dir of react files
        private static final String REACT_DIR = &quot;/static/&quot;;
        private static final String REACT_STATIC_DIR = &quot;static&quot;;
        private Resource index = new ClassPathResource(REACT_DIR + &quot;index.html&quot;);
        private List&lt;string&gt; rootStaticFiles = Arrays.asList(&quot;favicon.io&quot;,
                &quot;asset-manifest.json&quot;, &quot;manifest.json&quot;, &quot;service-worker.js&quot;);

        @Override
        public Resource resolveResource(
            HttpServletRequest request, String requestPath,
            List locations, ResourceResolverChain chain) {
            return resolve(requestPath, locations);
        }

        @Override
        public String resolveUrlPath(
            String resourcePath, List locations,
            ResourceResolverChain chain) {
            Resource resolvedResource = resolve(resourcePath, locations);
            if (resolvedResource == null) {
                return null;
            }
            try {
                return resolvedResource.getURL().toString();
            } catch (IOException e) {
                return resolvedResource.getFilename();
            }
        }

        private Resource resolve(
            String requestPath, List locations) {

            if (requestPath == null) return null;

            if (rootStaticFiles.contains(requestPath)
                    || requestPath.startsWith(REACT_STATIC_DIR)) {
                return new ClassPathResource(REACT_DIR + requestPath);
            } else
                return index;
        }

    }
}
&lt;/string&gt;&lt;/code&gt;
&lt;/pre&gt;
&lt;/li&gt;
&lt;/ol&gt;
Its done. Application frontend will run as smooth.

&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/27506564505195122/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2019/07/how-to-host-react-js-code-with-spring.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/27506564505195122'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/27506564505195122'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2019/07/how-to-host-react-js-code-with-spring.html' title='How to host React JS code with Spring Boot Application'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-7090256494254928751</id><published>2019-04-22T17:19:00.000+05:30</published><updated>2019-04-22T17:19:42.789+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="IOS app"/><category scheme="http://www.blogger.com/atom/ns#" term="IOS Bridging"/><category scheme="http://www.blogger.com/atom/ns#" term="Objective-C"/><category scheme="http://www.blogger.com/atom/ns#" term="React Native"/><title type='text'>How to read and get value from Info.plist file using react native in IOS app</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Info.plist file is a very important file which handles all the configuration for an app. We can use this file to have some custom information specific to app which can be read when app is getting loaded.&lt;br /&gt;
&lt;br /&gt;
To read the file we need to make a bridge component that allow us to get values from the plist file. Because app cannot directly read the file until the app is developed in native language.&lt;br /&gt;
&lt;br /&gt;
Info.plist is having data in JSON format, which can be read as key, value pair.&lt;br /&gt;
&lt;br /&gt;
First, we need to create a custom class (Objective-C) that will read info.plist file and send the response back to app.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;
#import &quot;AppConfig.h&quot;
@interface AppConfig()
@end

@implementation AppConfig
RCT_EXPORT_MODULE();

RCT_EXPORT_METHOD(getPListValue:(NSString *)param callback:(RCTResponseSenderBlock)callback)
{
  NSString* paramValue = [[[NSBundle mainBundle] infoDictionary] valueForKey:param];
  if(paramValue == nil)
    paramValue = @&quot;&quot;;
  callback(@[[NSNull null], paramValue]);
}
@end

&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Using NativeModules we can call this function and get the value of any keys in react native. Import NativeModules from react-native and directly call the method as below:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;
import { NativeModules } from &#39;react-native&#39;;
NativeModules.AppConfig.getPListValue(&quot;keyName&quot;, (error, keyValue) =&amp;gt; {
  console.log(keyValue);
});
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
On running above code, it will log the key value for the specific key you have given in code as keyName.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/7090256494254928751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2019/04/read-and-get-value-from-infoplist.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/7090256494254928751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/7090256494254928751'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2019/04/read-and-get-value-from-infoplist.html' title='How to read and get value from Info.plist file using react native in IOS app'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-1112306544170694061</id><published>2019-04-22T14:44:00.002+05:30</published><updated>2019-04-22T14:44:28.274+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="IOS app"/><category scheme="http://www.blogger.com/atom/ns#" term="IOS Notifications"/><category scheme="http://www.blogger.com/atom/ns#" term="Objective-C"/><category scheme="http://www.blogger.com/atom/ns#" term="React Native"/><title type='text'>How to add action button in notifications of an ios app using react native</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
In this tutorial, we will learn how to add an action button on local notifications triggered by application using React Native.&lt;br /&gt;
&lt;br /&gt;
To achieve this, we need to create a bridge component that will enable communication between react-native and IOS. Below code is in Objective-C.&lt;br /&gt;
&lt;br /&gt;
We call the IOS function from react native and this objective C method will create buttons and append to notifications that come on device.&lt;br /&gt;
&lt;br /&gt;
Below are the steps:&lt;br /&gt;
&lt;br /&gt;
1) Create a custom ActionNotification.m file and add below code snippet into that:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;
#import &quot;ActionNotification.h&quot;
@interface ActionNotification()
@end

@implementation ActionNotification
RCT_EXPORT_MODULE();
RCT_EXPORT_METHOD(createUserNotificationSettings:(RCTResponseSenderBlock)callback)
{
  UIMutableUserNotificationAction *action1 = [[UIMutableUserNotificationAction alloc] init];
  [action1 setActivationMode: UIUserNotificationActivationModeForeground];
  [action1 setTitle:@&quot;Title1&quot;];
  [action1 setIdentifier:@&quot;first_button&quot;];
  [action1 setDestructive:YES];
  [action1 setAuthenticationRequired:NO];
  
  UIMutableUserNotificationAction *action2 = [[UIMutableUserNotificationAction alloc] init];
  [action2 setActivationMode: UIUserNotificationActivationModeForeground];
  [action2 setTitle:@&quot;Title2&quot;];
  [action2 setIdentifier:@&quot;second_button&quot;];
  [action2 setDestructive:NO];
  [action2 setAuthenticationRequired:NO];
  
  UIMutableUserNotificationCategory *actionCategory = [[UIMutableUserNotificationCategory alloc] init];
  [actionCategory setIdentifier:@&quot;actionCategory&quot;];
  [actionCategory setActions:@[action1, action2]
                  forContext:UIUserNotificationActionContextDefault];
  
  NSSet *categories = [NSSet setWithObject:actionCategory];
  UIUserNotificationType types = (UIUserNotificationTypeAlert|
                                  UIUserNotificationTypeSound|
                                  UIUserNotificationTypeBadge);
  
   [[UIApplication sharedApplication] registerUserNotificationSettings:[UIUserNotificationSettings settingsForTypes:types categories:categories]];
  callback(@[[NSNull null], @&quot;done&quot;]);
}
@end
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
In above implementation, we have created one method&amp;nbsp;&lt;span style=&quot;background-color: #f0f0f0; font-family: &amp;quot;arial&amp;quot;; font-size: 12px;&quot;&gt;createUserNotificationSettings,&lt;/span&gt;&amp;nbsp;which will add action buttons to notification. Now, this function need to be called just before scheduling the notification. Also, we need to make sure that identifier has been properly set. In above case, it must be &quot;actionCategory&quot;.&lt;br /&gt;
&lt;br /&gt;
2) Add Action Button Click Event function in AppDelegate.m file.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;
- (void)application:(UIApplication *)application handleActionWithIdentifier:(nullable NSString *)identifier forLocalNotification:(nonnull UILocalNotification *)notification withResponseInfo:(nonnull NSDictionary *)responseInfo completionHandler:(nonnull void (^)())completionHandler
{
  if ([identifier isEqualToString: @&quot;first_button&quot;]) {
    NSLog(@&quot;First notification button was pressed&quot;);
  } else {
    NSLog(@&quot;Second notification button was pressed&quot;);
  }
}
- (void)application:(UIApplication *)application handleActionWithIdentifier:(NSString *)identifier forRemoteNotification:(NSDictionary *)userInfo withResponseInfo:(NSDictionary *)responseInfo completionHandler:(void (^)())completionHandler
{
  if ([identifier isEqualToString: @&quot;first_button&quot;]) {
    NSLog(@&quot;First notification button was pressed&quot;);
  } else {
    NSLog(@&quot;Second notification button was pressed&quot;);
  }
}
&lt;/code&gt;
&lt;/pre&gt;
&lt;br /&gt;
The above functions will handle action button events.&lt;br /&gt;
&lt;br /&gt;
3) Now, create JS file that will call IOS function just before scheduling Notifications.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;
import { PushNotificationIOS, NativeModules } from &#39;react-native&#39;;

 NativeModules.ActionNotification.createUserNotificationSettings((error, status) =&amp;gt; {
    return status;
 });

 PushNotificationIOS.scheduleLocalNotification({
    fireDate: new Date(),
    alertBody: &quot;hello&quot;,
    category: &quot;actionCategory&quot; // category must match to what we have defined in create notification method in Objective-C
});
&lt;/code&gt;
&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
Thats it!&lt;br /&gt;
It should display the action button when any notification comes for that particular app.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/1112306544170694061/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2019/04/add-action-button-in-notification.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/1112306544170694061'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/1112306544170694061'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2019/04/add-action-button-in-notification.html' title='How to add action button in notifications of an ios app using react native'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-581415173675987343</id><published>2019-04-19T10:38:00.000+05:30</published><updated>2019-04-19T10:38:59.174+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="Windows OS"/><category scheme="http://www.blogger.com/atom/ns#" term="Windows product Key"/><title type='text'>How to get product key of windows OS installed on machine</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
Steps to get the product key of windows OS installed on the laptop, desktop or any other device.&lt;br /&gt;
&lt;br /&gt;
1) Press on Start Menu or Windows Key + X.&lt;br /&gt;
2) Open command prompt in Admin mode.&lt;br /&gt;
3) Enter below command:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;wmic path SoftwareLicensingService get OA3xOriginalProductKey
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhipWWMLtUYHyyCgsCFJwiNXWTMMr0vPKjdO6wFFn-W9ChZf9XhtQxNHTVEpmsnRcn8sCVVjUK8SECD8ld-cYpdlo4YFf1ZCyLFs04sg9pyuAQfpanWsj6oFlaF3l3_SrnKkLyuUAuULEod/s1600/Capture.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;178&quot; data-original-width=&quot;679&quot; height=&quot;167&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhipWWMLtUYHyyCgsCFJwiNXWTMMr0vPKjdO6wFFn-W9ChZf9XhtQxNHTVEpmsnRcn8sCVVjUK8SECD8ld-cYpdlo4YFf1ZCyLFs04sg9pyuAQfpanWsj6oFlaF3l3_SrnKkLyuUAuULEod/s640/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/581415173675987343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2019/04/how-to-get-product-key-of-windows-os.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/581415173675987343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/581415173675987343'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2019/04/how-to-get-product-key-of-windows-os.html' title='How to get product key of windows OS installed on machine'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhipWWMLtUYHyyCgsCFJwiNXWTMMr0vPKjdO6wFFn-W9ChZf9XhtQxNHTVEpmsnRcn8sCVVjUK8SECD8ld-cYpdlo4YFf1ZCyLFs04sg9pyuAQfpanWsj6oFlaF3l3_SrnKkLyuUAuULEod/s72-c/Capture.PNG" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-8721956822011556726</id><published>2018-04-25T11:53:00.001+05:30</published><updated>2018-04-25T11:53:33.516+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="GIT"/><title type='text'>How to update password in GIT using command line</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
As we know, using GIT through command line is one of the best way to handle repos. However, sometimes we faces issues when we update GIT password and command line does not take the updated password automatically.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
To fix this issue, we can use the below commands:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
For windows:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;git config --global credential.helper wincred
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
For Mac
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;git config --global credential.helper osckeychain
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Once execute above commands, run command that you want to execute, it will prompt for username and password again.&lt;br /&gt;
&lt;br /&gt;
Hope it helps, let me know in case it does not work.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/8721956822011556726/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2018/04/how-to-update-password-in-git-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/8721956822011556726'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/8721956822011556726'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2018/04/how-to-update-password-in-git-using.html' title='How to update password in GIT using command line'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-5346227509004962898</id><published>2018-03-25T11:03:00.001+05:30</published><updated>2018-03-25T11:07:57.200+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="GULP"/><category scheme="http://www.blogger.com/atom/ns#" term="Istanbul"/><category scheme="http://www.blogger.com/atom/ns#" term="UnitTesting"/><title type='text'>How to config gulp to run unit test cases using Istanbul with code coverage</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Add below configuration in &lt;b&gt;gulpfile&lt;/b&gt;.js for running &lt;b&gt;Istanbul &lt;/b&gt;with &lt;b&gt;mocha &lt;/b&gt;unit test cases through&amp;nbsp;gulp.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;
const gulp = require(&#39;gulp&#39;);
const istanbul = require(&#39;gulp-istanbul&#39;);
const mocha = require(&#39;gulp-mocha&#39;);

gulp.task(&#39;test&#39;, () =&amp;gt; {    
 gulp.src([&#39;src/**/*.js&#39;])
    .pipe(istanbul())
    .pipe(istanbul.hookRequire())
    .on(&#39;finish&#39;, () =&amp;gt; {
      gulp.src([&#39;test/unit/**/*.spec.js&#39;])
        .pipe(mocha())
        .pipe(istanbul.writeReports({
          dir: &#39;./test/unit-test-coverage&#39;,
          reporters: [&#39;lcov&#39;, &#39;clover&#39;, &#39;text&#39;, &#39;text-summary&#39;],
          reportOpts: {
            dir: &#39;./test/unit-test-coverage&#39;,
          },
        }));        
    });
 });

&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
For code coverage, we can use &lt;b&gt;istanbul.writeReports&lt;/b&gt; method as shown above.&lt;br /&gt;
&lt;br /&gt;
Once executing the command &lt;b&gt;gulp test&lt;/b&gt;, it will execute all the test cases along with coverage report generated at given location.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/5346227509004962898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2018/03/config-gulp-to-run-unit-test-istanbul.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/5346227509004962898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/5346227509004962898'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2018/03/config-gulp-to-run-unit-test-istanbul.html' title='How to config gulp to run unit test cases using Istanbul with code coverage'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-7428255040442330156</id><published>2018-03-25T10:26:00.000+05:30</published><updated>2018-03-25T10:42:07.639+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="GULP"/><category scheme="http://www.blogger.com/atom/ns#" term="JEST"/><category scheme="http://www.blogger.com/atom/ns#" term="UnitTesting"/><title type='text'>Running Jest using Gulp with code coverage</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Jest is a unit test framework that is mainly used for reactjs. Jest is widely used by facebook in their projects.&lt;br /&gt;
&lt;br /&gt;
Add below configuration in &lt;b&gt;gulpfile&lt;/b&gt;.js for running &lt;b&gt;Jest &lt;/b&gt;unit test cases through &lt;b&gt;gulp&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;
  const gulp = require(&#39;gulp&#39;);
  const jestcli = require(&#39;jest-cli&#39;);

  gulp.task(&#39;test&#39;, () =&amp;gt; {  
   jestcli.runCLI({ config: { rootDir: &#39;test/unit/&#39; } }, &#39;.&#39;, (done) =&amp;gt; {
    done();
   });
  });
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Using command:&lt;b&gt; gulp test&lt;/b&gt;, will execute the test cases written under directory &lt;b&gt;&#39;test/unit&#39;&lt;/b&gt;. To have code coverage, we can configure it in &lt;b&gt;package.json&lt;/b&gt; file as below:&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;
  &quot;jest&quot;: {
    &quot;collectCoverage&quot;: true,
    &quot;coverageDirectory&quot;: &quot;./test/unit-test-coverage&quot;
  }
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Add above config in &lt;b&gt;package.json&lt;/b&gt; file. for defining custom directory to create the report, mention the directory in coverageDirectory key, otherwise it will generate at root directory.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/7428255040442330156/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2018/03/jest-using-gulp-with-code-coverage.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/7428255040442330156'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/7428255040442330156'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2018/03/jest-using-gulp-with-code-coverage.html' title='Running Jest using Gulp with code coverage'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-8467394115304493805</id><published>2017-01-27T14:12:00.002+05:30</published><updated>2018-03-25T09:47:14.103+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="HSQLDB"/><title type='text'>How to check if database exists while connecting in HSQLDB</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;In HSQLDB, if while providing connection string if the database does not exists, it creates a new database. However, lets say if we want to restrict HSQLDB to create new Database and only connect to exists one and if not present then throw back an exception, we can specify a connection property &lt;b&gt;&lt;i&gt;ifexists=true&lt;/i&gt;.&lt;/b&gt; This will allow only to connect to an existing database and avoid creating new one. Also, if db does not exists it will throw an exception.&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; Connection c = DriverManager.getConnection( &quot;jdbc:hsqldb:file:testdb;ifexists=true&quot;, &quot;SA&quot;, &quot;&quot;);  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/8467394115304493805/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2017/01/check-if-database-exists-HSQLDB.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/8467394115304493805'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/8467394115304493805'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2017/01/check-if-database-exists-HSQLDB.html' title='How to check if database exists while connecting in HSQLDB'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-268543349198619895</id><published>2017-01-25T18:16:00.000+05:30</published><updated>2017-01-25T18:16:29.583+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB"/><title type='text'>How to compare two fields value while querying in mongodb</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
To compare 2 fields of a document while querying in mongodb, we need to use $where.&lt;br /&gt;
&lt;br /&gt;
Lets see the example to compare 2 fields of a document:
&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; Employee Collection  
           {    
             &quot;_id&quot; : 1,    
             &quot;name&quot; : {    
                &quot;first&quot; : &quot;Abhi&quot;,    
                &quot;last&quot; : &quot;Dev&quot;    
             },    
             &quot;department&quot; : &quot;finance&quot;,    
             &quot;joineddate&quot; : &quot;2010-04-10&quot;     
            },    
            {    
             &quot;_id&quot; : 2,    
             &quot;name&quot; : {    
                &quot;first&quot; : &quot;Agrawal&quot;,    
                &quot;last&quot; : &quot;Agrawal&quot;    
             },     
             &quot;joineddate&quot; : &quot;2006-07-07&quot;     
            },    
            {    
             &quot;_id&quot; : 3,    
             &quot;name&quot; : {    
                &quot;first&quot; : &quot;Dhruv&quot;,    
                &quot;last&quot; : &quot;Agrawal&quot;    
             },    
             &quot;department&quot; : &quot;finance&quot;,    
             &quot;joineddate&quot; : &quot;2010-09-07&quot;     
            }  
           }   
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Now lets say I need to fetch data which has first and last values are equal.&lt;br /&gt;
&lt;br /&gt;
The query would be:&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; db.employee.find({ $where : &quot;this.name.last == this.name.first&quot; })  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
The output would be:&lt;br /&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.469px;&quot;&gt;&lt;code style=&quot;word-wrap: normal;&quot;&gt;{    
             &quot;_id&quot; : 2,    
             &quot;name&quot; : {    
                &quot;first&quot; : &quot;Agrawal&quot;,    
                &quot;last&quot; : &quot;Agrawal&quot;    
             }&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/268543349198619895/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2017/01/query-to-compare-two-fields-mongodb.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/268543349198619895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/268543349198619895'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2017/01/query-to-compare-two-fields-mongodb.html' title='How to compare two fields value while querying in mongodb'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-102006516855396365</id><published>2017-01-18T14:47:00.003+05:30</published><updated>2017-01-18T14:47:54.968+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB"/><title type='text'>How to update specific records of array field in collection using MongoDB</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
To update specific records of an array field in MongoDB, we can achieve that by using JavaScript with Mongo query. Below are the two ways to update the arrays. Lets see both ways to update the data.&lt;br /&gt;
&lt;br /&gt;
Employee Collection:&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; {  
           &quot;_id&quot; : 1,    
        &quot;name&quot; : {    
           &quot;first&quot; : &quot;Abhi&quot;,    
           &quot;last&quot; : &quot;Dev&quot;    
        },    
        &quot;profile&quot;:[ {&quot;department&quot; : &quot;finance&quot;, &quot;joineddate&quot; : &quot;2010-04-10&quot;},  
                          {&quot;department&quot; : &quot;marketing&quot;, &quot;joineddate&quot; : &quot;2008-05-05&quot;},  
                          {&quot;department&quot; : &quot;hr&quot;, &quot;joineddate&quot; : &quot;2006-08-05&quot;}  
                          ]  
      },    
      {    
        &quot;_id&quot; : 2,    
        &quot;name&quot; : {    
           &quot;first&quot; : &quot;Dhruv&quot;,    
           &quot;last&quot; : &quot;Sharma&quot;    
        },    
        &quot;profile&quot;:[ {&quot;department&quot; : &quot;retail&quot;, &quot;joineddate&quot; : &quot;2013-07-10&quot;},  
                          {&quot;department&quot; : &quot;finance&quot;, &quot;joineddate&quot; : &quot;2010-05-25&quot;},  
                          {&quot;department&quot; : &quot;hr&quot;, &quot;joineddate&quot; : &quot;2007-08-05&quot;}  
                          ]    
      }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Objective is to update above array&#39;s &lt;i&gt;joineddate&lt;/i&gt; field where department is finance.&lt;br /&gt;
Option 1: Updating the array using JavaScript:&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; db.employee.find({}).  
      forEach(function(doc){  
           doc.profile.forEach(function(d){  
                if(d.department == &quot;finance&quot;)  
                {       
                     d.joineddate = &quot;2016-12-12&quot;  
                }  
           });            
           db.employee.save(doc);  
      })   
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Option 2: Updating array using Mongo Query operators update and set:
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; var query = {  
   profile: {  
     $elemMatch: {  
       department: &quot;finance&quot;,  
       joineddate: {$ne: &quot;2016-12-12&quot;}  
     }  
   }  
 };  
 while (db.employee.find(query).count() &amp;gt; 0) {  
   db.employee.update(  
     query,  
     { $set: { &quot;profile.$.joineddate&quot;: &quot;2016-12-12&quot; } },  
     { multi: true }  
   );  
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/102006516855396365/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2017/01/update-specific-records-of-array-mongodb.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/102006516855396365'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/102006516855396365'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2017/01/update-specific-records-of-array-mongodb.html' title='How to update specific records of array field in collection using MongoDB'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-6944594030803628261</id><published>2017-01-17T17:48:00.001+05:30</published><updated>2017-01-17T17:48:07.201+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB"/><title type='text'>How to update field using data from same document&#39;s another field</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
We cannot directly use update method to update the field with same document&#39;s another field. We need to first iterate the data and then use save method to update the same.&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
For example:&lt;/div&gt;
&lt;div&gt;
Employee Collection&lt;/div&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; {    
     &quot;_id&quot; : 1,               
     &quot;name&quot; : {   
          &quot;full_name&quot; : &quot;AD&quot;,  
          &quot;first&quot; : &quot;Abhi&quot;,    
           &quot;last&quot; : &quot;Dev&quot;    
      },    
      &quot;department&quot; : &quot;finance&quot;,    
     &quot;joineddate&quot; : &quot;2010-04-10&quot;     
 }  
   
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
Lets say I have above collection document that I need to update. Full name of this document should be updated with First and Last field.&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; db.employee.find().snapshot().forEach(  
  function (e) {  
   // update document, using its own properties  
   e.name.full_name = e.name.first + &quot; &quot; +e.name.last;  
   // save the updated document  
   db.employee.save(e);  
  }  
 )       
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
As you can see here, we are using snapshot query modifier. The $snapshot operator prevents the cursor from returning a document more than once because an intervening write operation results in a move of the document.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/6944594030803628261/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2017/01/update-field-using-data-same-document.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/6944594030803628261'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/6944594030803628261'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2017/01/update-field-using-data-same-document.html' title='How to update field using data from same document&#39;s another field'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-340038329447935341</id><published>2017-01-17T12:18:00.000+05:30</published><updated>2017-01-17T12:21:54.185+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB"/><title type='text'>How to connect MongoDB with authentication in JAVA</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
To connect MongoDB through JAVA, we will use MongoClient and to fetch and iterate data we will use MongoCollection and FindIterable classes.&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;
As of version 3.2, mongoclient.getDB method is deprecated. The deprecation of this method effectively deprecates the DB, DBCollection, and DBCursor classes, among others. That&#39;s the reason we will use the new methods and classes like MongoCollection, MongoDatabase and FindIterable correspondingly.&lt;/div&gt;
&lt;h4 style=&quot;text-align: justify;&quot;&gt;
&lt;span style=&quot;text-align: left;&quot;&gt;Full example of MongoDB connection in JAVA&lt;/span&gt;&lt;/h4&gt;
&lt;div&gt;
&lt;div&gt;
Employee Collection&lt;/div&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; {    
             &quot;_id&quot; : 1,    
             &quot;name&quot; : {    
                &quot;first&quot; : &quot;Abhi&quot;,    
                &quot;last&quot; : &quot;Dev&quot;    
             },    
             &quot;department&quot; : &quot;finance&quot;,    
             &quot;joineddate&quot; : &quot;2010-04-10&quot;     
            },    
            {    
             &quot;_id&quot; : 2,    
             &quot;name&quot; : {    
                &quot;first&quot; : &quot;Alok&quot;,    
                &quot;last&quot; : &quot;Agrawal&quot;    
             },     
             &quot;joineddate&quot; : &quot;2006-07-07&quot;     
            },    
            {    
             &quot;_id&quot; : 3,    
             &quot;name&quot; : {    
                &quot;first&quot; : &quot;Dhruv&quot;,    
                &quot;last&quot; : &quot;Sharma&quot;    
             },    
             &quot;department&quot; : &quot;finance&quot;,    
             &quot;joineddate&quot; : &quot;2010-09-07&quot;     
            }  
           }   
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;
JAVA code for Mongo Connection and fetching the data.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; 
import org.bson.Document;

import com.mongodb.MongoClient;
import com.mongodb.MongoClientURI;
import com.mongodb.client.FindIterable;
import com.mongodb.client.MongoCollection;
import com.mongodb.client.MongoDatabase;

public class Test {

 public static void main(String[] args) {
String mongoClientURI = &quot;mongodb://username:password@hostname:port/dbname&quot;;  
           MongoClient mongoClient = new MongoClient(new MongoClientURI(mongoClientURI));  
           MongoDatabase md = mongoClient.getDatabase(&quot;dbname&quot;);  
           MongoCollection&amp;lt;Document&amp;gt; mgColl = md.getCollection(&quot;employee&quot;);  
           Document assortCCObj = new Document(&quot;department&quot;, &quot;finance&quot;);            
           assortCCObj.append(&quot;joineddate&quot;, new Document(&quot;$gt&quot;, &quot;2010-01-01&quot;));  
           FindIterable&amp;lt;Document&amp;gt; dt = mgColl.find(assortCCObj);  
           for (Document document : dt) {  
                System.out.println(document.toJson());  
           }  
    }
 }
&lt;/code&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;br /&gt;
The above code will connect to mongo and fetch data from employee collection as per the given criteria.&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/340038329447935341/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2017/01/connect-mongodb-using-java.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/340038329447935341'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/340038329447935341'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2017/01/connect-mongodb-using-java.html' title='How to connect MongoDB with authentication in JAVA'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-335856759960951349</id><published>2017-01-16T10:47:00.001+05:30</published><updated>2017-01-16T10:51:59.692+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongpDB Topics"/><title type='text'>MongoDB Topics</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;a href=&quot;http://tech-heap.blogspot.in/2017/01/how-to-use-exists-to-check-field-is.html&quot;&gt;How to use $EXISTS to check the field is null or not in mongodb&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul style=&quot;text-align: left;&quot;&gt;
&lt;li&gt;&lt;span style=&quot;background-color: white; color: black; font-family: &amp;quot;arial&amp;quot; , serif; font-size: small; text-decoration: none;&quot;&gt;&lt;a href=&quot;http://tech-heap.blogspot.in/2017/01/how-to-increase-performance-while.html&quot; style=&quot;background-color: white; font-family: arial, serif; text-decoration: none;&quot;&gt;How to increase performance while fetching the data from MongoDB&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;h4 style=&quot;font-family: Arial, serif;&quot;&gt;
&lt;span style=&quot;background-color: white; color: black; font-size: small;&quot;&gt;&lt;a href=&quot;http://tech-heap.blogspot.in/2017/01/how-to-use-like-keyword-in-mongodb.html&quot;&gt;How to use like keyword in mongodb&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;li&gt;&lt;h4 style=&quot;font-family: Arial, serif;&quot;&gt;
&lt;span style=&quot;background-color: white; color: black;&quot;&gt;&lt;a href=&quot;http://tech-heap.blogspot.in/2016/12/execute-mongodb-queries-from-command.html&quot;&gt;Execute MongoDB queries from command prompt&lt;/a&gt;&lt;/span&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;li&gt;&lt;h4 style=&quot;font-family: Arial, serif;&quot;&gt;
&lt;a href=&quot;http://tech-heap.blogspot.in/2016/12/example-of-bulk-updates-in-mongodb.html&quot;&gt;&lt;span style=&quot;background-color: white; color: black; font-size: small;&quot;&gt;Example of bulk updates in MongoDB&lt;/span&gt;&lt;/a&gt;&lt;/h4&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/335856759960951349/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2017/01/mongodb-topics.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/335856759960951349'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/335856759960951349'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2017/01/mongodb-topics.html' title='MongoDB Topics'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-7501503727419964145</id><published>2017-01-16T10:25:00.003+05:30</published><updated>2017-01-16T10:25:51.422+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB"/><title type='text'>How to use $EXISTS to check the field is null or not in mongodb</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
$exists is an element query operator that can be use to check the existense of any field in a document.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;i&gt;Syntax: { field: { $exists: &lt;boolean&gt; } }&lt;/boolean&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
If&lt;i&gt; { $exists: true }&lt;/i&gt;, it will matches the documents which contain the field.&lt;br /&gt;
&lt;br /&gt;
If &lt;i&gt;{ $exists: false }&lt;/i&gt;, it will matches the documents which does not contain the field.&lt;br /&gt;
&lt;br /&gt;
For example:&lt;br /&gt;
Employee Collection&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; {    
   &quot;_id&quot; : 1,    
   &quot;name&quot; : {    
   &quot;first&quot; : &quot;Abhi&quot;,    
   &quot;last&quot; : &quot;Dev&quot;    
   },    
   &quot;department&quot; : &quot;finance&quot;,    
   &quot;joineddate&quot; : &quot;2000-04-10&quot;     
  },    
  {    
   &quot;_id&quot; : 2,    
   &quot;name&quot; : {    
   &quot;first&quot; : &quot;Alok&quot;,    
   &quot;last&quot; : &quot;Agrawal&quot;    
   },     
   &quot;joineddate&quot; : &quot;2006-07-07&quot;     
  },    
  {    
   &quot;_id&quot; : 3,    
   &quot;name&quot; : {    
   &quot;first&quot; : &quot;Dhruv&quot;,    
   &quot;last&quot; : &quot;Sharma&quot;    
   },    
   &quot;department&quot; : &quot;finance&quot;,    
   &quot;joineddate&quot; : &quot;2010-09-07&quot;     
  },   
  {    
   &quot;_id&quot; : 4,    
   &quot;name&quot; : {    
   &quot;first&quot; : &quot;Ravi&quot;,    
   &quot;last&quot; : &quot;Mann&quot;    
   },    
   &quot;department&quot; : &quot;information&quot;,    
   &quot;joineddate&quot; : &quot;2008-04-07&quot;     
  }  
 }    
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
In above collection, document &lt;i&gt;{id : 2}&lt;/i&gt; does not have department field. So, lets say if we need to search the documents which does not have department field, the query would be:&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; db.employee.find({department: {$exists : false}})  
&lt;/code&gt;&lt;/pre&gt;
Output of Above Query:&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; {    
   &quot;_id&quot; : 2,    
   &quot;name&quot; : {    
   &quot;first&quot; : &quot;Alok&quot;,    
   &quot;last&quot; : &quot;Agrawal&quot;    
   },     
   &quot;joineddate&quot; : &quot;2006-07-07&quot;     
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/7501503727419964145/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2017/01/how-to-use-exists-to-check-field-is.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/7501503727419964145'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/7501503727419964145'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2017/01/how-to-use-exists-to-check-field-is.html' title='How to use $EXISTS to check the field is null or not in mongodb'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-1863715496652901165</id><published>2017-01-15T11:27:00.000+05:30</published><updated>2017-01-15T11:27:20.085+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB"/><title type='text'>How to increase performance while fetching the data from MongoDB</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
MongoDB is a no-sql database, which can contain huge data in collections. Due to non relational /un-structered data, it takes load of time while fetching it from DB.&lt;br /&gt;
&lt;br /&gt;
We can if query mongo smartly it can fetch the data very fastly. One way to do it is to limit the output data. There would be many cases when the objective of querying the mongo is to just get some specific fields details. For example, I have a collection of employee and I need to search employee first name starts from &#39;A&#39; and I only need to fetch its first name. now one way is to use below query to fetch the data which will fetch the whole document which mets the criteria:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 587.063px;&quot;&gt;&lt;code style=&quot;word-wrap: normal;&quot;&gt;  db.employee.find({&quot;name&quot; : &quot;/^A/&quot;})  &lt;/code&gt;&lt;/pre&gt;
Output:&lt;br /&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 587.063px;&quot;&gt;&lt;code style=&quot;word-wrap: normal;&quot;&gt;{   
   &quot;_id&quot; : 1,   
   &quot;name&quot; : {   
    &quot;first&quot; : &quot;Abhi&quot;,   
    &quot;last&quot; : &quot;Dev&quot;   
   },   
   &quot;department&quot; : &quot;finance&quot;,   
   &quot;joineddate&quot; : &quot;2000-04-10&quot;      
  },   
  {   
   &quot;_id&quot; : 2,   
   &quot;name&quot; : {   
    &quot;first&quot; : &quot;Alok&quot;,   
    &quot;last&quot; : &quot;Agrawal&quot;   
   },   
   &quot;department&quot; : &quot;information&quot;,   
   &quot;joineddate&quot; : &quot;2006-07-07&quot;      
  }&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
But if I limit the data outcome and only specify the fields which I want as in this case I only need to see first name, we can use projection and make it possible as:&lt;br /&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 587.063px;&quot;&gt;&lt;code style=&quot;word-wrap: normal;&quot;&gt;  db.employee.find({&quot;name&quot; : &quot;/^A/&quot;},{&quot;name.first&quot;:1})  &lt;/code&gt;&lt;/pre&gt;
Output&lt;br /&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 587.063px;&quot;&gt;&lt;code style=&quot;word-wrap: normal;&quot;&gt;  {   
   &quot;_id&quot; : 1,   
   &quot;name&quot; : {   
    &quot;first&quot; : &quot;Abhi&quot;
   }   
  },   
  {   
   &quot;_id&quot; : 2,   
   &quot;name&quot; : {   
    &quot;first&quot; : &quot;Alok   
   }      
  }&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
As we can see on above output it reduces the data, which will enhance the performance of query.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/1863715496652901165/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2017/01/how-to-increase-performance-while.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/1863715496652901165'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/1863715496652901165'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2017/01/how-to-increase-performance-while.html' title='How to increase performance while fetching the data from MongoDB'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-7868551383234258491</id><published>2017-01-15T11:07:00.001+05:30</published><updated>2017-01-15T11:11:32.561+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB"/><title type='text'>How to use like keyword in mongodb</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Like SQL statements we can use LIKE keywords in Mongo as well. We can query mongdb with LIKE search. We can restrict LIKE search as we do in SQL using &#39;%&#39; as&lt;br /&gt;
&lt;br /&gt;
&lt;pre class=&quot;lang-js prettyprint prettyprinted&quot; style=&quot;background-color: #eff0f1; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;&quot;&gt;&lt;code style=&quot;border: 0px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;employee&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;border: 0px; color: #7d2727; margin: 0px; padding: 0px;&quot;&gt;/text/&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;})&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #858c93; margin: 0px; padding: 0px;&quot;&gt;//like &#39;%text%&#39;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;lang-js prettyprint prettyprinted&quot; style=&quot;background-color: #eff0f1; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;&quot;&gt;&lt;code style=&quot;border: 0px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;employee&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;border: 0px; color: #7d2727; margin: 0px; padding: 0px;&quot;&gt;/^txt/&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;})&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #858c93; margin: 0px; padding: 0px;&quot;&gt;//like &#39;text%&#39;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=&quot;lang-js prettyprint prettyprinted&quot; style=&quot;background-color: #eff0f1; border: 0px; color: #393318; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; font-size: 13px; margin-bottom: 1em; max-height: 600px; overflow: auto; padding: 5px; width: auto; word-wrap: normal;&quot;&gt;&lt;code style=&quot;border: 0px; font-family: Consolas, Menlo, Monaco, &amp;quot;Lucida Console&amp;quot;, &amp;quot;Liberation Mono&amp;quot;, &amp;quot;DejaVu Sans Mono&amp;quot;, &amp;quot;Bitstream Vera Sans Mono&amp;quot;, &amp;quot;Courier New&amp;quot;, monospace, sans-serif; margin: 0px; padding: 0px; white-space: inherit;&quot;&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;db&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;employee&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;find&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;({&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt; &lt;/span&gt;&lt;span class=&quot;str&quot; style=&quot;border: 0px; color: #7d2727; margin: 0px; padding: 0px;&quot;&gt;/text$/&lt;/span&gt;&lt;span class=&quot;pun&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;})&lt;/span&gt;&lt;span class=&quot;pln&quot; style=&quot;border: 0px; color: #303336; margin: 0px; padding: 0px;&quot;&gt;  &lt;/span&gt;&lt;span class=&quot;com&quot; style=&quot;border: 0px; color: #858c93; margin: 0px; padding: 0px;&quot;&gt;//like &#39;text%&#39;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;
&lt;b&gt;Examples&lt;/b&gt;:&lt;br /&gt;
&lt;br /&gt;
Employee Collection&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; {   
   &quot;_id&quot; : 1,   
   &quot;name&quot; : {   
    &quot;first&quot; : &quot;Abhi&quot;,   
    &quot;last&quot; : &quot;Dev&quot;   
   },   
   &quot;department&quot; : &quot;finance&quot;,   
   &quot;joineddate&quot; : &quot;2000-04-10&quot;      
  },   
  {   
   &quot;_id&quot; : 2,   
   &quot;name&quot; : {   
    &quot;first&quot; : &quot;Alok&quot;,   
    &quot;last&quot; : &quot;Agrawal&quot;   
   },   
   &quot;department&quot; : &quot;information&quot;,   
   &quot;joineddate&quot; : &quot;2006-07-07&quot;      
  },   
  {   
   &quot;_id&quot; : 3,   
   &quot;name&quot; : {   
    &quot;first&quot; : &quot;Dhruv&quot;,   
    &quot;last&quot; : &quot;Sharma&quot;   
   },   
   &quot;department&quot; : &quot;finance&quot;,   
   &quot;joineddate&quot; : &quot;2010-09-07&quot;      
  }   
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Lets say from above collection I need to search for name which has &#39;h&#39; in it. So, the query would be:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;  db.employee.find({&quot;name&quot; : &quot;/h/&quot;},{name:1})  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
The above will fetch 2 results from collection as:&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;  {    
   &quot;_id&quot; : 1,    
   &quot;name&quot; : {    
   &quot;first&quot; : &quot;Abhi&quot;,    
   &quot;last&quot; : &quot;Dev&quot;    
   }  
  },  
  {    
   &quot;_id&quot; : 3,    
   &quot;name&quot; : {    
   &quot;first&quot; : &quot;Dhruv&quot;,    
   &quot;last&quot; : &quot;Sharma&quot;    
   }   
  }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Now, lets say I need to search name that start with &#39;A&#39;, so the query would be:&lt;br /&gt;
&lt;pre style=&quot;background: rgb(240, 240, 240); border: 1px dashed rgb(204, 204, 204); font-family: arial; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; width: 646.469px;&quot;&gt;&lt;code style=&quot;word-wrap: normal;&quot;&gt;  db.employee.find({&quot;name&quot; : &quot;/^A/&quot;},{name:1})  
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;code style=&quot;word-wrap: normal;&quot;&gt;&lt;br /&gt;&lt;/code&gt;
&lt;code style=&quot;word-wrap: normal;&quot;&gt;Query Output:&lt;/code&gt;&lt;br /&gt;

&lt;code style=&quot;word-wrap: normal;&quot;&gt;&lt;/code&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt;  {    
   &quot;_id&quot; : 1,    
   &quot;name&quot; : {    
   &quot;first&quot; : &quot;Abhi&quot;,    
   &quot;last&quot; : &quot;Dev&quot;    
   }   
  },  
  {    
   &quot;_id&quot; : 2,    
   &quot;name&quot; : {    
   &quot;first&quot; : &quot;Alok&quot;,    
   &quot;last&quot; : &quot;Agrawal&quot;    
   }   
  }   
&lt;/code&gt;&lt;/pre&gt;
&lt;div&gt;
&lt;code style=&quot;word-wrap: normal;&quot;&gt;&lt;br /&gt;&lt;/code&gt;
&lt;code style=&quot;word-wrap: normal;&quot;&gt;There are many regex we can use similarly to filter the search as per the need.&lt;/code&gt;&lt;/div&gt;
&lt;div&gt;
&lt;code style=&quot;word-wrap: normal;&quot;&gt;&lt;br /&gt;&lt;/code&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/7868551383234258491/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2017/01/how-to-use-like-keyword-in-mongodb.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/7868551383234258491'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/7868551383234258491'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2017/01/how-to-use-like-keyword-in-mongodb.html' title='How to use like keyword in mongodb'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-3534443246699947654</id><published>2016-12-20T17:28:00.002+05:30</published><updated>2016-12-20T17:28:31.041+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB"/><title type='text'>Execute MongoDB queries from command prompt</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Execute MongoDB queries from command prompt&lt;br /&gt;
&lt;br /&gt;
we can run mongodb queries from command prompt as well. Run command prompt in administrator mode.&lt;br /&gt;
&lt;br /&gt;
Go to the mongo installation path till bin folder.&lt;br /&gt;
&lt;br /&gt;
In windows, it should be like:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; c:\Program Files\Mongo\server\3.2\bin  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Use below command to execute the mongo query :&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; mongo &amp;lt;hostname&amp;gt;:&amp;lt;portnumber&amp;gt;/&amp;lt;dbname&amp;gt; -u &amp;lt;user&amp;gt; -p &amp;lt;pass&amp;gt; db.employee.find(&quot;department&quot; : &quot;finance&quot;)  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
The above command will connect to the given DB details and execute the query.&lt;br /&gt;
&lt;br /&gt;
It will show the data in command prompt itself.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/3534443246699947654/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2016/12/execute-mongodb-queries-from-command.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/3534443246699947654'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/3534443246699947654'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2016/12/execute-mongodb-queries-from-command.html' title='Execute MongoDB queries from command prompt'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-2346170070931542335</id><published>2016-12-20T17:17:00.000+05:30</published><updated>2016-12-20T17:17:44.016+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB"/><title type='text'>How to print specific data from Collection or document using Javascript in MongoDB</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
How to print specific data from Collection or document using Javascript in MongoDB&lt;br /&gt;
&lt;br /&gt;
Mongo supports javascript queries to handle the data and process as per the need.&lt;br /&gt;
&lt;br /&gt;
For example,&lt;br /&gt;
&lt;br /&gt;
Employee collection&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; {  
   &quot;_id&quot; : 1,  
   &quot;name&quot; : {  
     &quot;first&quot; : &quot;Abhi&quot;,  
     &quot;last&quot; : &quot;Dev&quot;  
   },  
   &quot;department&quot; : &quot;finance&quot;,  
   &quot;joineddate&quot; : &quot;2000-04-10&quot;       
 },  
 {  
   &quot;_id&quot; : 2,  
   &quot;name&quot; : {  
     &quot;first&quot; : &quot;Alok&quot;,  
     &quot;last&quot; : &quot;Agrawal&quot;  
   },  
   &quot;department&quot; : &quot;information&quot;,  
   &quot;joineddate&quot; : &quot;2006-07-07&quot;       
 },  
 {  
   &quot;_id&quot; : 3,  
   &quot;name&quot; : {  
     &quot;first&quot; : &quot;Dhruv&quot;,  
     &quot;last&quot; : &quot;Sharma&quot;  
   },  
   &quot;department&quot; : &quot;finance&quot;,  
   &quot;joineddate&quot; : &quot;2010-09-07&quot;       
 }  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Now, lets say I need to print only the name who are in finance department.&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; db.employee.find(&quot;department&quot; : &quot;finance&quot;).forEach(     
   function(doc) {   
    print(doc.name.first + &quot; &quot; + doc.name.last);   
   );  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
The above query will print all the employee first name and last name whose department is finance.&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/2346170070931542335/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2016/12/print-data-using-javascript-mongdb.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/2346170070931542335'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/2346170070931542335'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2016/12/print-data-using-javascript-mongdb.html' title='How to print specific data from Collection or document using Javascript in MongoDB'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1055866655041959795.post-3184915015078572143</id><published>2016-12-16T10:19:00.001+05:30</published><updated>2016-12-16T10:19:21.671+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="MongoDB"/><title type='text'>Example of bulk updates in MongoDB</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Mongo Allows to have bulk updates using following operation:&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; db.collection.initializeOrderedBulkOp()  
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
Initializes and returns a &lt;i&gt;new Bulk()&lt;/i&gt; operations builder for a collection.&lt;br /&gt;
&lt;br /&gt;
The builder constructs an ordered list of write operations that MongoDB executes in bulk.&lt;br /&gt;
&lt;br /&gt;
Full Example&lt;br /&gt;
&lt;br /&gt;
In this example we will update name from &quot;ABC One&quot; to &quot;ABC Two&quot; in whole collection&lt;br /&gt;
&lt;br /&gt;
&lt;pre style=&quot;background: #f0f0f0; border: 1px dashed #cccccc; color: black; font-family: &amp;quot;arial&amp;quot;; font-size: 12px; height: auto; line-height: 20px; overflow: auto; padding: 0px; text-align: left; width: 99%;&quot;&gt;&lt;code style=&quot;color: black; word-wrap: normal;&quot;&gt; //initialize Bulk operation  
 var bulk = db.test.initializeOrderedBulkOp();   
 db.test.find({&quot;name&quot;: /ABC One/})  
   .forEach(function(doc){  
           print (doc.name)      
     name = doc.name.replace(&quot;ABC One&quot;, &quot;ABC Two&quot;)  
           bulk.find({&quot;_id&quot; :doc._id}).  
       updateOne(  
         { $set:   
         {   
           &quot;name&quot;: name  
         }}  
       );  
           print(doc.name)                 
   })  
  bulk.execute(); 
&lt;/code&gt;&lt;/pre&gt;
&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://tech-heap.blogspot.com/feeds/3184915015078572143/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tech-heap.blogspot.com/2016/12/example-of-bulk-updates-in-mongodb.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/3184915015078572143'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1055866655041959795/posts/default/3184915015078572143'/><link rel='alternate' type='text/html' href='http://tech-heap.blogspot.com/2016/12/example-of-bulk-updates-in-mongodb.html' title='Example of bulk updates in MongoDB'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>