<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Shashank Banerjea on Medium]]></title>
        <description><![CDATA[Stories by Shashank Banerjea on Medium]]></description>
        <link>https://medium.com/@shashank-banerjea?source=rss-6c28109d0df0------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*HLwjVy3C8qi42V_A.</url>
            <title>Stories by Shashank Banerjea on Medium</title>
            <link>https://medium.com/@shashank-banerjea?source=rss-6c28109d0df0------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 19:54:35 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@shashank-banerjea/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A MongoDB Learning journey]]></title>
            <link>https://shashank-banerjea.medium.com/a-mongodb-learning-journey-467af462c458?source=rss-6c28109d0df0------2</link>
            <guid isPermaLink="false">https://medium.com/p/467af462c458</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[nosql]]></category>
            <category><![CDATA[beginner]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[mongodb]]></category>
            <dc:creator><![CDATA[Shashank Banerjea]]></dc:creator>
            <pubDate>Mon, 12 Jul 2021 17:53:06 GMT</pubDate>
            <atom:updated>2022-04-20T01:43:33.757Z</atom:updated>
            <content:encoded><![CDATA[<p>A tale of a SQL developer, fumbling and then tumbling into love with MongoDB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dhRzgYFYGXhSgy9q" /><figcaption>Photo by <a href="https://unsplash.com/@campaign_creators?utm_source=medium&amp;utm_medium=referral">Campaign Creators</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Introduction</h3><p>This is my tale of fumbling and tumbling into love with MongoDB, as the data store for the product, we are building at <a href="https://www.introvoke.com/"><strong>Introvoke</strong></a>, to power right scale branded virtual and hybrid event experiences for organizers, OEMs and enterprises.</p><p>Most of professional life while developing applications using different technology stacks, I have primarily used RDBMS as my data store. Many times it was Microsoft SQL Server as I was primarily a .NET/C# developer working at <a href="https://www.microsoft.com/"><strong>Microsoft</strong></a>. I had the pleasure of working with MySQL, PostgreSQL, IBM DB2 and yes, Oracle as well, working for start ups, software vendors, educational institutions and large enterprises. Good and robust products, for the solutions they power and price points they offer.</p><p>Until I joined my new role at Introvoke in late April 2021, my primary exposure to NoSQL technology was via <a href="https://azure.microsoft.com/en-us/services/cosmos-db/"><strong>Azure Cosmos DB</strong></a>. To appeal to enterprise developers like myself, Cosmos DB offers a SQL like query language and that is what I defaulted to when I used Cosmos DB.</p><p>The choice to use MongoDB and in a hosted fashion using <a href="https://www.mongodb.com/cloud/atlas">MongoDB Atlas</a> was done prior to my arrival at Introvoke.</p><p>My primary responsibility at Introvoke is to build and manage analytics, integrations and API for the platform.</p><p>The first task that I was pulled into was to make calculations of consumption on our platform perform better and more precise, so I had to dive right into learning MongoDB, right away. (<em>Ahh… I only heard of </em><strong><em>tech intensity</em></strong><em> as an industry buzzword from Satya Nadella, when I was at Microsoft and now I was feeling it)</em>.</p><h3>Learning Path</h3><p>This is the path I took. As anything else in life, there are always more ways than one and varies by learning style.</p><h4>Pluralsight Courses</h4><p>The reason I jumped in here was primarily — HABIT. As a engineer at Microsoft, this was one of many learning resources that was available to me and over the years it became the good starting point.</p><p>The courses which helped me on my path were:</p><ul><li><a href="https://app.pluralsight.com/library/courses/foundations-document-databases-mongodb/table-of-contents"><strong>Foundations of Document Databases with MongoDB by Pinal Dave</strong></a>: <br>Pinal Dave has been a well known expert (See: [SQL Authority](<a href="https://blog.sqlauthority.com/">https://blog.sqlauthority.com/</a>)) in the SQL world as well, so I trusted the content authored by Pinal would be high quality. It also seemed to me that Pinal would have insights into both SQL and NoSQL worlds, so easy choice there.</li><li><a href="https://app.pluralsight.com/library/courses/aggregating-data-across-documents-mongodb/table-of-contents"><strong>Aggregating Data across Documents in MongoDB by Axel Sirota</strong></a>: Aggregation is a powerful feature in MongoDB. I rave about it in the later section. This course is a good premier to what is possible with it.</li><li><a href="https://app.pluralsight.com/library/courses/mongodb-nodejs/table-of-contents"><strong>Using MongoDB with Node.js by Jonathan Mills</strong></a>: : Since I was building applications at Introvoke using Node.js, this course was good fit to combine them.</li></ul><p>There are tons of other courses on Node.js and MongoDB on Pluralsight to explore, but I found these relevant immediately to what I aiming for and course content was up to date.</p><h4>MongoDB University</h4><p>What better place to learn MongoDB but from the people who made it. Here is where <a href="https://university.mongodb.com/"><strong>MongoDB University</strong></a> comes in.</p><p>Easy to learn courses and well defined learning path and best of all at no cost! I believe, the end goal for the courses, would be obtain MongoDB certification. I started getting links to this via e-mail after signing up for a free MongoDB Atlas account.</p><h4>MongoDB documentation</h4><p>Believe it or not, <a href="https://docs.mongodb.com/"><strong>MongoDB documentation</strong></a> is very good. It is very rich in examples. I was able to follow the documentation in most cases easily and apply the examples in my queries.</p><h4>Quick Start — MongoDB and Node.js article and YouTube series</h4><p>I came across this <strong>four-part </strong><a href="https://www.mongodb.com/blog/post/quick-start-nodejs-mongodb--how-to-get-connected-to-your-database"><strong>article</strong></a><strong> and </strong><a href="https://www.youtube.com/watch?v=fbYExfeFsI0"><strong>YouTube</strong></a><strong> series</strong> on using Node.js and MongoDB by MongoDB’s Developer Advocate Lauren Schaefer, while looking for a way on how to react to changes in the data in MongoDB collection. That would be <a href="https://docs.mongodb.com/manual/changeStreams/"><strong>change stream</strong></a><strong>s</strong> in MongoDB similar to <a href="https://docs.microsoft.com/en-us/azure/cosmos-db/change-feed"><strong>Change Feed</strong></a> in Azure Cosmos DB or <a href="https://docs.microsoft.com/en-us/sql/relational-databases/track-changes/about-change-data-capture-sql-server?view=sql-server-ver15"><strong>Change Data Capture</strong></a> in SQL Server.</p><p>I loved Lauren’s style of delivery, her deep technical expertise and how beautifully she explains advanced topics with ease and lots of examples. The video, I started out with was last in the series, but I liked it so much, I went back read the previous three articles and watched the full video series.</p><h4>Of course, Stack Overflow</h4><p>This is probably a no-brainer but worth mentioning anyhow. MongoDB has a rich developer community backing it. If there is anything you are thinking about, the chances are someone has asked or has solved it for you at <a href="https://www.stackoverflow.com/">Stack Overflow</a>. The only caveat is sometimes, the solutions relate to older versions of MongoDB, but I have seen the community very good about making that distinction while responding to queries, especially between MongoDB 3.x and 4.x.</p><h3>My Primary Mental Blockers</h3><p>As with learning new technology, I had to unlearn some old habits. Among them was how to think about storing data differently from the world of `SQL JOINS`.</p><p>At Introvoke, I did inherit a very de-normalized data store with various collections. But where there was gaps, I was trying to create JOINS, which was not always easy to pull off syntax wise for a newbie. Over past two months, I have gradually become better.</p><p>The same thought process also influencing me on how to store data in a normalized manner focusing on storing ids and instead of embedding documents.</p><p>One of the articles, which has help me design better and think more in terms on how data is to be accessed versus trying to store data concisely was this article — <a href="https://developer.mongodb.com/article/mongodb-schema-design-best-practices/"><strong>MongoDB Schema Design Best Practices by Joe Karlssson</strong></a>.</p><p>I think, it is a learning curve, most developers will face coming from the RDBMS world. As I discovered, getting a optimal solution does take some experimentation.</p><h3>My favorite features</h3><h4>MongoDB Query Language</h4><p>The <strong>MongoDB Query Language (MQL)</strong> is very powerful and in most instances very intuitive, though it can be verbose at times.</p><h4>Aggregates</h4><p>The <a href="https://docs.mongodb.com/manual/aggregation/"><strong>aggregation framework</strong></a>, in my opinion is the most powerful feature in MongoDB and I use it on almost every functionality, I am building to return data. It can help you shape the data down to how your APIs need to return it as their data contract. <strong>Almost zero ORM.</strong> Imagine that doing it in SQL world.</p><p>The only place where I have not been able to use aggregation pipeline is data has been stored across different MongoDB clusters. That is where the Node.js application has to stitch results from different queries together, which to my amazement is real fast. That is probably a discussion for a different article.</p><h4>Facets</h4><p>I discovered this feature of the aggregation framework — <a href="https://docs.mongodb.com/manual/reference/operator/aggregation/facet/">facet</a>, two weeks into writing queries and tying them into the API. I found it especially useful in places, where I started with the same filtered data but had to run multiple different grouping calculation on it (dimensions for data warehouse folks out there). Prior to that I was writing multiple queries for it and calling it from the application.</p><h3>My Pet Peeves</h3><h4>BLANK results</h4><p>In the SQL world, for queries with incorrect names of the tables or columns, the schema enforcement would prompt an immediate feedback. Not so in MongoDB, it returns empty result, which can become a head scratcher at times.</p><p>There have been instances where I have misspelled the collection or the field name. For example, in some collections the unique identifier for a Company entity is called — `<em>company</em>` and `<em>companyId</em>` in others.</p><p>Another one is misspelling a collection named `<em>EventsAggregates</em>`, as `<em>EventAggregates</em>` or `<em>EventsAggregate</em>`.</p><p>I do wish at least for the collection name, there was some validation, which could alert the developer of the error. The one with the document structure, the responsibility lies with the developer (or the development team) to establish naming patterns for columns across collections.</p><h3>My Developer Toolkit</h3><p>I found the following tools <strong>must-haves</strong> for my developer journey learning how to use MongoDB and building queries for my day to day application</p><h4>MongoDB Compass</h4><p><a href="https://docs.mongodb.com/compass/current/">MongoDB Compass</a> is a free cross-platform tool from MongoDB. It is great for exploring data and running queries in built in Mongo Shell. I found error reporting when developing queries so much more useful than on MongoDB extension is VS code. However for writing the MQL code, I would advice to go with an editor such as Visual Studio Code or Sublime.</p><h4>MongoDB Extension for Visual Studio Code</h4><p>If you are developing using Node.js or Typescript, the chances are you are using Visual Studio code. There is an excellent <a href="https://docs.mongodb.com/mongodb-vscode/">VS Code Extension for MongoDB</a> which provides connection management, browsing MongoDB collections with VS code, syntax highlighting for MQL code.The only limitation I found with the plugin, is I have not been able to get the it to return more than 20 documents for a query. There is a setting when viewing document collections but it does not seem to apply to the custom queries.</p><h3>Journey continues</h3><p>At the time of writing this article in June 2021, it has been only two months into learning this fantastic technology. I am sure, I will have more to say in the coming days.</p><h3>References</h3><ul><li><a href="https://www.mongodb.com/"><strong>MongoDB Official Links</strong></a><br>- <a href="https://docs.mongodb.com/">MongoDB documentation</a><br>- <a href="https://university.mongodb.com/">MongoDB University</a> <br>- <a href="https://www.mongodb.com/blog/post/quick-start-nodejs-mongodb--how-to-get-connected-to-your-database">Four part article series for MongoDB with Node.js by Lauren Schaefer</a><br>- <a href="https://developer.mongodb.com/article/mongodb-schema-design-best-practices/">MongoDB Schema Design Best Practices by Joe Karlssson</a></li><li><a href="https://www.pluralsight.com/"><strong>Pluralsight</strong></a><strong> courses</strong><br>- <a href="https://app.pluralsight.com/library/courses/foundations-document-databases-mongodb/table-of-contents">Foundations of Document Databases with MongoDB by Pinal Dave</a><br>- <a href="https://app.pluralsight.com/library/courses/aggregating-data-across-documents-mongodb/table-of-contents">Aggregating Data across Documents in MongoDB by Axel Sirota</a>]()<br>- <a href="https://app.pluralsight.com/library/courses/mongodb-nodejs/table-of-contents">Using MongoDB with Node.js by Jonathan Mills</a></li><li><strong>Developer Toolkit<br>- </strong><a href="https://code.visualstudio.com/">Visual Studio Code</a><br>- <a href="https://docs.mongodb.com/mongodb-vscode/">MongoDB for VS Code</a><br>- <a href="https://docs.mongodb.com/compass/current/">MongoDB Compass</a></li></ul><h4><strong>DISCLAIMER</strong></h4><p><em>Opinions expressed in this article are solely mine and do NOT represent those of my employer.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=467af462c458" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Azure Data Factory Automation — Adding Log Analytics for Monitoring]]></title>
            <link>https://shashank-banerjea.medium.com/azure-data-factory-automation-adding-log-analytics-for-monitoring-e2bf1e96479c?source=rss-6c28109d0df0------2</link>
            <guid isPermaLink="false">https://medium.com/p/e2bf1e96479c</guid>
            <category><![CDATA[azure-data-factory]]></category>
            <category><![CDATA[monitoring]]></category>
            <category><![CDATA[azure]]></category>
            <category><![CDATA[azure-log-analytics]]></category>
            <dc:creator><![CDATA[Shashank Banerjea]]></dc:creator>
            <pubDate>Sun, 03 Jan 2021 18:49:18 GMT</pubDate>
            <atom:updated>2021-01-03T19:00:59.511Z</atom:updated>
            <content:encoded><![CDATA[<h3>Azure Data Factory Automation — Adding Log Analytics for Monitoring</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*_A9ybNhfMM98s1F3" /><figcaption>Photo by <a href="https://unsplash.com/@lukechesser?utm_source=medium&amp;utm_medium=referral">Luke Chesser</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>One of the challenges, that I often faced with automating deployment of Azure Data Factory has been to add monitoring to the Azure Data Factory in a scriptable way.</p><p>The monitoring is essential to broad system health. For example, to generate alerts failures or if a pipeline is running longer than expected. The preferred and documented way of generating this alert has been to push the logs to Azure Log Analytics and analyzing the logs to generate alerts or provide a broad monitoring capability integrated with other parts of the infrastructure on Azure.</p><p>The <a href="https://docs.microsoft.com/en-us/azure/data-factory/monitor-using-azure-monitor#enable-diagnostic-logs-via-the-azure-monitor-rest-api">Azure Data Factory documentation</a> does provide a method using the Azure Monitor REST API. However it is little unwieldy to use, especially in CI/CD pipelines.</p><p>There is another method to do this is actually that is well documented but not often referred to. It is available in the documentation for <a href="https://docs.microsoft.com/en-us/azure/azure-monitor/platform/diagnostic-settings?WT.mc_id=Portal-Microsoft_Azure_Monitoring#create-using-azure-cli">Azure Monitor</a>.</p><p>So, associating an Log Analytics as a diagnostics log and metrics sink for Azure Data Factory using Azure CLI becomes as simple as running the script below:</p><p>az monitor diagnostic-settings create \<br> — name LogAnalytics02-Diagnostics \<br> — resource /subscriptions/<strong>(your-subscription)</strong>/resourceGroups/<strong>(your-resource-group)</strong>/providers/Microsoft.DataFactory/factories/(<strong>data-factory-name)</strong> \<br> — logs ‘[{“category”: “PipelineRuns”,”enabled”: true}]’ \<br> — metrics ‘[{“category”: “AllMetrics”,”enabled”: true}]’ \<br> — workspace /subscriptions/<strong>(your-subscription)</strong>/resourcegroups/<strong>(your-resource-group)</strong>/providers/microsoft.operationalinsights/workspaces/(<strong>your-log-analytics-workspace-name)</strong></p><p>The pre-requisite to run this scripts are — Azure Data Factory Instance and Log Analytics workspace should already be provisioned.</p><p>Just substitute the values for subscriptions and resources with values that applies to you. The example above shows just adding the logs for <em>PipelineRuns </em>but you can add more values in JSON string for <em>logs </em>parameter.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e2bf1e96479c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Useful Azure Data Explorer queries for Azure Data Factory pipelines]]></title>
            <link>https://shashank-banerjea.medium.com/useful-azure-data-explorer-queries-for-azure-data-factory-pipelines-60253f398c8b?source=rss-6c28109d0df0------2</link>
            <guid isPermaLink="false">https://medium.com/p/60253f398c8b</guid>
            <category><![CDATA[azure-monitor]]></category>
            <category><![CDATA[azure-data-explorer]]></category>
            <category><![CDATA[log-analytics]]></category>
            <category><![CDATA[azure-data-factory]]></category>
            <dc:creator><![CDATA[Shashank Banerjea]]></dc:creator>
            <pubDate>Fri, 04 Oct 2019 06:59:44 GMT</pubDate>
            <atom:updated>2019-10-04T06:59:44.161Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Monitoring the Azure Data Factory Pipelines</strong></h3><p>Monitoring Azure Data Factory is enabled through collecting diagnostic logs and posting them to Log Analytics (part of Azure Monitor). The other options include — Storage Account or Event Hub for custom processing. There are additional settings provide options to decide what information that can are to be captured. It is also possible to have multiple settings for collecting diagnostic logs, where it is possible to send different data to different collection stores.</p><p>The most readily available monitoring is available through Log Analytics Workspace and Azure Data Factory Workbook available in the Azure Marketplace. Detailed documentation to enable monitoring through is available <a href="https://docs.microsoft.com/en-us/azure/data-factory/monitor-using-azure-monitor#monitor-data-factory-metrics-with-azure-monitor">here</a>.</p><h3><strong>Useful Azure Data Explorer Queries</strong></h3><p>While the workbook is helpful in surfacing some of the key metrics across multiple data factory instance it is helpful to write couple of custom queries in Azure Data Explorer to review some performance statistics of a Pipeline run.</p><p>Following the instructions in the link provided in the section above, you will have created a Log Analytics Workspace to store the Azure Data Factory diagnostic data. The data for Pipeline run is available in table called — “ADFPipelineRun”.</p><h4><strong>Viewing Duration of Pipeline Runs</strong></h4><p>One of the useful queries that I find is to view how long my succeeding pipeline are taking. For this example, we assume, what we are monitoring a pipeline called — “<em>gsc2adlsgen2copy”</em>. A query for the pipeline that would look like:</p><pre>ADFPipelineRun<br>| where Status == &quot;Succeeded&quot;<br>| where PipelineName == &quot;gcs2adlsgen2copy&quot;<br>| project PipelineName, RunId, Start, End, (End - Start)</pre><p>The query above returns all the execution time of the pipeline. This query returns all the executions of the pipeline (within the time frame set by the query explorer) and how much time they took.</p><h4><strong>Viewing number of Pipeline Runs exceeding a threshold</strong></h4><p>If we have established an SLA for the Pipeline run, we can add a threshold value into the query to view pipelines that exceed the threshold. The query would look like this with an arbitrary threshold of 15 seconds:</p><pre>ADFPipelineRun<br>| where Status == &quot;Succeeded&quot;<br>| where PipelineName == &quot;gcs2adlsgen2copy&quot;<br>| where (End - Start) &gt; 15s<br>| project PipelineName, RunId, Start, End, (End - Start)</pre><p><strong>Generating Alerts on missed SLA</strong></p><p>To generate an alert from the query above, click on the “+ New Alert” button on top of the query window and select to build a new alert on the Custom query.</p><figure><img alt="New Alert Button" src="https://cdn-images-1.medium.com/max/1022/1*a00BbvdHdA_LYXVhCSMu9A.png" /><figcaption>New Alert Button</figcaption></figure><p>Shown below is the alert created for the query above, based on number of rows returned, monitored every 24 hours for past 24 hours.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zvkiiL-BaMODnNgr4VvnQg.png" /><figcaption>Custom Alert Action</figcaption></figure><h3><strong>Conclusion</strong></h3><p>Azure Pipelines can be monitored using Azure Monitor. Alerts can be generated using custom Azure Data Explorer queries when a pipeline takes too long or does not run over a period. More reasons to rejoice and rest easy, my fellow cloud dwellers.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=60253f398c8b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>