<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shavant Thomas</title>
    <description>The latest articles on DEV Community by Shavant Thomas (@avantsekai).</description>
    <link>https://dev.to/avantsekai</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F55250%2Ffc09d3ba-698f-472d-beab-7aca4ed8b576.jpeg</url>
      <title>DEV Community: Shavant Thomas</title>
      <link>https://dev.to/avantsekai</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/avantsekai"/>
    <language>en</language>
    <item>
      <title>Getting Started in CI/CD using CircleCI</title>
      <dc:creator>Shavant Thomas</dc:creator>
      <pubDate>Mon, 29 Jun 2020 00:15:47 +0000</pubDate>
      <link>https://dev.to/avantsekai/getting-started-in-ci-cd-using-circleci-353e</link>
      <guid>https://dev.to/avantsekai/getting-started-in-ci-cd-using-circleci-353e</guid>
      <description>&lt;h1&gt;
  
  
  CI/CD = CI/CD^2 = CI/CD/CD???
&lt;/h1&gt;

&lt;p&gt;Exactly what is CI/CD? Sure many know what the short version stands for and even then it can be a little confusing. For instance maybe you get Continuous Integration. It allows small and/or quick changes to be committed and integrated into your main branch . There is some confidence in the integrity of your code; because it should be constantly going through unit and integration testing. It is also able to build consistently. What about CD however? Possibly you have heard two different definitions. However they can sound very similar if not the same just from the naming alone. So is it Continuous Delivery or Continuous Deployment? Well it's both and while its often used interchangeably they are different. In tech many things are kept short and/or abstract. So while everyone uses the short version to keep it concise, I like to think about it really as CI/CD/CD or CI/CD^2. Translation  Continuous Integration, Continuous Delivery, Continuous Deployment.  &lt;/p&gt;

&lt;h1&gt;
  
  
  Continuous Delivery
&lt;/h1&gt;

&lt;p&gt;Continuous Delivery builds on CI. CI gives a nice automated process which produces a sanity build of your software. Now you need a nice auto delivery of the product. Let us refer to Continuous Delivery as CD for this part. With a small team its easy to imagine various states going on all at once. Someone can be checking in code while another has some test going on etc etc. We need a way to see the updates and possibly how it works in a central live environment. For many this is called the staging environment. The staging environment is usually where anyone on the team can test and review before we deploy to production for all to see.  However we don't want someone constantly waiting to act on this; nor do we want everyone's hands in the pot do we? Instead we want a predictable routine. This includes some defined rules which can be viewed by anyone such as a schedule for instance. Using reproducible steps which run the same on each iteration. We want this process to be predictable resulting in an expected quality product each time. Managing environment, services, etc, should also be included in CD. By having this automated delivery process we can have a happier and more productive team. Just how work is constantly being produced and changes are happing at any moment. The pipeline is set to constantly keep churning out new versions of the product.  &lt;/p&gt;

&lt;h1&gt;
  
  
  Continuous Deployment
&lt;/h1&gt;

&lt;p&gt;Many stop at Continuous Delivery and with good reason. Not everyone is ready or even desires Continuous Deployment. Where as Continuous Integration and Delivery were about how the organization can benefit and improve workflow productivity. Deployment now involves the users. Continuous Deployment is the next step up and is about deploying to your production environment. With no one to interfere the product quickly goes from being in house to now being live for all users. As you can imagine their is a  huge reliance on automation for all this to happen. Therefore  due diligence needs to be done by reviewing the entire pipeline. To each their own but some may not want or can't implement this due to standards and regulations. Others may not have the automation in place for infrastructure or rollbacks in case something fails. One can name a ton of possibilities as to why or why not to implement. Whatever the reason Continuous Deployment rewards should be weighed heavily along with the risks.  &lt;/p&gt;

&lt;h1&gt;
  
  
  Why CircleCI?
&lt;/h1&gt;

&lt;p&gt;I have dealt with my share of CI/CD tools but for this post CircleCI will be the focal point. It's the one I have become accustomed with the most lately. While I am sure down the line I will experiment with another tool again I must admit I really like it.  It has a ton of features I like but something I really appreciate is just how easy it is to get started with a new project. In this post I'll walk through how to get up and running locally as well as with the cloud platform. &lt;/p&gt;

&lt;p&gt;Why a local setup? There are a few benefits but speed and convenience are big ones. Having some minimal quick access to debug files and config changes, without having to commit and push each time were reason enough to pique my interest. The time investment to set up locally is also very little in the grand scheme of things; So why not get the most out of it? Of course you will need to sign up for a CircleCI account (&lt;a href="http://circleci.com"&gt;circleci.com&lt;/a&gt;) which is free to start building. It can also instantly be used with a Github or bitbucket account.  &lt;/p&gt;

&lt;h1&gt;
  
  
  Install CircleCI with HomeBrew
&lt;/h1&gt;

&lt;p&gt;There are several ways to install CircleCI locally but I did it through good old trusty homebrew. Because I had Docker for Mac already installed. It's actually recommended that you use the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install --ignore-dependencies circleci
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If you don't have Docker for Mac install just do&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install circleci
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now lets validate that you indeed have it installed and that everything is working as expected.&lt;/p&gt;

&lt;p&gt;You are going to want to obtain your &lt;strong&gt;Personal API token&lt;/strong&gt;. Once signed into your CircleCI account, navigate to User Settings → Personal API Token and generate a new one, if you don't have one already. Make sure to copy it somewhere, since you won't be able to see it again. If lost you will need to regenerate a new token.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TB2mDDyN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/96pty1f3tjmnob96uxb1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TB2mDDyN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/96pty1f3tjmnob96uxb1.png" alt="Token Snapshot"&gt;&lt;/a&gt; &lt;br&gt;
&lt;em&gt;Personal API Tokens&lt;/em&gt;. &lt;/p&gt;

&lt;p&gt;With the newly acquired Personal API Token you can now configure circleci. Run the command below and it will start a quick walkthrough. If you are not setting this up on a dev server or in the cloud yourself, the default circleci website supplied is your host.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;circleci setup
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Validate that your local setup works. In a project root directory create .circleci/config.yml. For validation purposes just copy &amp;amp; paste the barebones setup below which you will want to change later to suit your purposes.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight yaml"&gt;&lt;code&gt;&lt;span class="na"&gt;version&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2.1&lt;/span&gt;
&lt;span class="na"&gt;jobs&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;build&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
    &lt;span class="na"&gt;docker&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;circleci/node:12.16.1&lt;/span&gt; &lt;span class="c1"&gt;# the primary container, where your job's commands are run&lt;/span&gt;
    &lt;span class="na"&gt;steps&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="s"&gt;checkout&lt;/span&gt; &lt;span class="c1"&gt;# check out the code in the project directory&lt;/span&gt;
      &lt;span class="pi"&gt;-&lt;/span&gt; &lt;span class="na"&gt;run&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;echo "hello world"&lt;/span&gt; &lt;span class="c1"&gt;# run the `echo` command&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Running the validate command in the root of your project directory should find the config file and return a statement that the file is valid.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;circleci config validate
Config file at .circleci/config.yml is valid.
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h1&gt;
  
  
  Conclusion
&lt;/h1&gt;

&lt;p&gt;You now have a working CI pipeline locally. However thats not the only thing you accomplished. Remember earlier I stated I liked how easy CircleCI makes it to get up and running? While this post guided you through a local setup. You already have what you need to start using the cloud hosted platform as well. With your Github or Bitbucket account you used to sign up for CircleCI. Once you push the branch up to your repository with the changes you made  in ".circleci/config.yml". Your cloud account will also do its thing and run the pipeline. Pretty much you are already up and running. Go ahead and give it go.  Moving forward as the code gets updated, you should also make the proper changes to update the config.yml as needed. This is just the start and will be a series of post. As we progress, we will walk through some of those changes together. Please feel free and let me know any thoughts, comments, questions. Till next time!&lt;/p&gt;

</description>
      <category>devops</category>
      <category>tutorial</category>
      <category>codepipeline</category>
      <category>development</category>
    </item>
    <item>
      <title>Terminal++ with iTerm2 &amp; ohmyzsh</title>
      <dc:creator>Shavant Thomas</dc:creator>
      <pubDate>Sat, 04 Apr 2020 20:01:27 +0000</pubDate>
      <link>https://dev.to/avantsekai/terminal-with-iterm2-ohmyzsh-7ko</link>
      <guid>https://dev.to/avantsekai/terminal-with-iterm2-ohmyzsh-7ko</guid>
      <description>&lt;p&gt;One thing I love about getting a new dev machine is starting off fresh. After getting my new MacBook Pro one of the first things I look forward to is setting up my dev environment. For me this starts with my shell &amp;amp; terminal setup. &lt;/p&gt;

&lt;h2&gt;
  
  
  Table of Contents
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;PreReqs&lt;/li&gt;
&lt;li&gt;iTerm2&lt;/li&gt;
&lt;li&gt;
OH MY ZSH! &lt;/li&gt;
&lt;li&gt;
What's your Theme?

&lt;ul&gt;
&lt;li&gt;Choose a Theme&lt;/li&gt;
&lt;li&gt;Install your Theme&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
Time to Power Up!

&lt;ul&gt;
&lt;li&gt;Powerlevel10K&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;The Wrap Up&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  PreReqs? &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;If you don't have Homebrew installed you will want to do that first as the rest of this post assumes so. Homebrew pauses and explains what its doing so expect interaction on your part as well. &lt;/p&gt;

&lt;p&gt;Copy &amp;amp; Paste the snippet below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;xcode-select --install
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  Upgrade your Terminal - iTerm2 &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;By this I mean if you're still only using the basic terminal that comes with your Macbook its  time to consider making the switch to iTerm2. Before you ask why just take a visit to the features page on the website. &lt;/p&gt;

&lt;p&gt;Download and Install using this link: &lt;a href="https://www.iterm2.com/downloads.html"&gt;https://www.iterm2.com/downloads.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;OR&lt;/p&gt;

&lt;p&gt;Use cask from brew to install.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew cask install iterm2
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h2&gt;
  
  
  OH MY ZSH! &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--x3tjpw9K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ohmyz.sh/img/OMZLogo_BnW.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--x3tjpw9K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://ohmyz.sh/img/OMZLogo_BnW.png" alt="oh my zsh"&gt;&lt;/a&gt;&lt;br&gt;
To complete the base package this gem should be in your toolkit. Firstly make sure that you already are using a zsh shell. For new macs this should already be your default. If you're upgrading to Catalina or have an older OS you may need to switch your shell. In your new downloaded iTerm2 shell simply confirm with an echo command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;echo $SHELL
/bin/zsh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You are good to go as long as "/bin/zsh" was returned. If another shell was returned you  either need to change your default shell&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;chsh -s /bin/zsh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;or install zsh before proceeding.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew install zsh
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now its time to proceed with what we are really here for; &lt;strong&gt;oh-my-zsh.&lt;/strong&gt; If iterm is like getting the combo meal. Then &lt;strong&gt;oh-my-zsh&lt;/strong&gt; is like ordering from the secret menu. You can take a look at their page (&lt;a href="https://ohmyz.sh/"&gt;https://ohmyz.sh/&lt;/a&gt;) and/or just google to see what the fuss is all about.&lt;/p&gt;

&lt;p&gt;Install &lt;strong&gt;oh-my-zsh:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You should notice the change to your shell now but if not just restart iterm2. Now you got your tools and it's time for the fun part. Customization!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note: The Rest of the article follows my personal setup. Follow along if you are interested in a similar configuration or tips on how to customize your own setup.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What's your Theme? &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;em&gt;Choose a Theme&lt;/em&gt; &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;Let's start off by choosing a theme. Themes can be found at &lt;a href="https://iterm2colorschemes.com/"&gt;https://iterm2colorschemes.com/&lt;/a&gt;. To install simply navigate by going to:&lt;/p&gt;

&lt;p&gt;iTerm2 → Preferences → Profiles → Colors → Color Presets → Visit Online Gallery. &lt;/p&gt;

&lt;p&gt;This will take you to the same page mentioned above. Near the top of the page you will see some folders named "tar.gz" and ".zip". By clicking on either of the folders you are able to download the entire bundle of themes on the page.  Of course if you are already on that page you can skip all of that navigation as well.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--YGR5OcS8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/i5twm271v3n0jjk389r6.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--YGR5OcS8--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/i5twm271v3n0jjk389r6.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  &lt;em&gt;Install your Theme&lt;/em&gt; &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;iTerm2 → Preferences → Profiles → Colors → Color Presets → Import → →schemes → &lt;/p&gt;

&lt;p&gt;After this when you go back to Color Presets you will now see the theme you want as an option to be selected. &lt;/p&gt;
&lt;h2&gt;
  
  
  Time to Power Up! &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;oh-my-zsh has its own set of themes that can give a boost to the look and feel of your terminal. The default along with many others can be found on the git documentation page but there are more out there if you are willing to search.&lt;/p&gt;

&lt;p&gt;GitHub Documentation:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://github.com/ohmyzsh/ohmyzsh/wiki/Themes"&gt;https://github.com/ohmyzsh/ohmyzsh/wiki/Themes&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Powerlevel10K &lt;a&gt;&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;My theme of choice is powerlevel10k. To install clone the repo&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone --depth=1 https://github.com/romkatv/powerlevel10k.git $ZSH_CUSTOM/themes/powerlevel10k
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Next in your ~/.zshrc set the theme&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ZSH_THEME="powerlevel10k/powerlevel10k"
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Save and source&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;source ~/.zshrc
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Upon success powerlevel10k will run a wizard for some setup configuration and will ask to install the Meslo Nerd Font; which is the recommended font for this theme.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0aNQZTNC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rv9u6fmnm8g618mzu5cs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0aNQZTNC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/rv9u6fmnm8g618mzu5cs.png" alt="Example Terminal"&gt;&lt;/a&gt;&lt;/p&gt;
 Example Screenshot of How my Terminal Setup looks



&lt;h2&gt;
  
  
  The Wrap Up &lt;a&gt;&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;Pretty much everything you need for an awesome terminal is now at your disposal. Of course there are far more customizations that can be done to tweak your setup and this will set you well on your way. Please share any comments or questions. I also plan on sharing more similar to this and possibly making a series for these kind of post. Let me know if there is something  in particular that piques your interest.&lt;/p&gt;

</description>
      <category>devops</category>
      <category>linux</category>
      <category>tutorial</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Be Aware of these MongoDB Gotchas</title>
      <dc:creator>Shavant Thomas</dc:creator>
      <pubDate>Sat, 01 Feb 2020 08:00:20 +0000</pubDate>
      <link>https://dev.to/avantsekai/be-aware-of-these-mongodb-gotchas-e1e</link>
      <guid>https://dev.to/avantsekai/be-aware-of-these-mongodb-gotchas-e1e</guid>
      <description>&lt;h2&gt;
  
  
  What is this about?
&lt;/h2&gt;

&lt;p&gt;We all have had those times where we take on a task and at first glance it seems like this should be straight forward. Suddenly you are left with a million questions  and many internet searches you've entertained have led you down a wormhole with no solutions in sight.  In my case this came about from a MongoDB migration in which I had to lead. &lt;/p&gt;

&lt;p&gt;Prior to this we hosted MongoDB on a few instances with collections for all our maintained environments.  One of the most important projects for the year meant we would be expecting a large influx of users which we were not ready for. The need for higher availability, scaling and speed were critical. &lt;/p&gt;

&lt;p&gt;Enter MongoDB Atlas.  Before proceeding any further let me start off by saying that MongoDB has some pretty good documentation; So I will be skipping over most of the "Getting Started" which can be found in MongoDB docs.  While I won't discuss every single obstacle.  Hopefully I can save others some precious time where I had little to spare.&lt;/p&gt;

&lt;h3&gt;
  
  
  TLDR version:
&lt;/h3&gt;

&lt;p&gt;A Few Gotchas to watch out for when doing a migration or starting out with MongoDB Atlas&lt;/p&gt;

&lt;h2&gt;
  
  
  Using a VPN? - Always check the Whitelist!
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--xYx9I8yo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/nguwjop9pm79jqu72jue.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xYx9I8yo--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_66%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/nguwjop9pm79jqu72jue.gif" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
I figured let's start off with my homer Simpson moment. VPN is used to access any of our instances and I am pretty much always running one. At first it took me a while as I worked through basic connections steps. However I soon realized this was my classic "D'OH" moment and I needed to whitelist my IP and make a mental note that when I see a connection error. Update it! &lt;/p&gt;

&lt;p&gt;Fortunately MongoDB makes it really easy to do this. Just a few clicks and you can add your current IP Address.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--e-9gHNcZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ttd40k6dzhuft6pzz6g3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--e-9gHNcZ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/ttd40k6dzhuft6pzz6g3.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Check and match all your versions. It's a Must!
&lt;/h2&gt;

&lt;p&gt;(If you're already using containers such as Docker you can skip this part about Matrix Hell. We were not!)&lt;/p&gt;

&lt;p&gt;Remember those match card memory  games?  In the game you needed to match up every pair and complete the whole set to win. I found the same to be true in my case of dealing with MongoDB. Through a ton of trial, documentation and yes even contacting support(which basically they just reiterated what I already had learned and attempted through documentation). It came down to me tracking down versions. Ruby, mongodb, mongoid, linux distro,  mongo shell.... Just basically check everything. As I was also in the process of upgrading our mongo version; this meant format changes had to be applied to the mongoid yaml configuration.  An example template of this can be found at this link.&lt;br&gt;
&lt;a href="https://github.com/mongodb/mongoid/blob/master/lib/rails/generators/mongoid/config/templates/mongoid.yml"&gt;Mongoid.yml&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Connection issues? - Try working your way through a manual connection.
&lt;/h3&gt;

&lt;p&gt;While MongoDb has some pretty good documentation there is still room for improvement. The suggestions for how to connect your app just were not working for me. Even support pretty much just repeated what I already had attempted thus far but they also never asked about what version I am using to help connect the dots. &lt;/p&gt;

&lt;p&gt;Finding the difference between when to use &lt;strong&gt;"mongodb+srv://"&lt;/strong&gt; or using &lt;strong&gt;"mongodb://"&lt;/strong&gt; is a pretty significant piece of info. It was only when comparing my working manual connection with the sites suggestions for setting up a config that I noticed this key difference. Replica sets, required info and options are all dealt with differently depending on which one you use. I feel this has some key differences that maybe could have been highlighted in a stronger way. As it took  the efforts of using a fine tooth comb to help figure out the discrepancies. &lt;/p&gt;

&lt;p&gt;Just take for example a barebones connection string. &lt;/p&gt;

&lt;p&gt;Older version:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mongodb://mongodb0.example.com:27017,[mongodb1.example.com:27017](http://mongodb1.example.com:27017/),[mongodb2.example.com:27017/admin?replicaSet=myRepl](http://mongodb2.example.com:27017/admin?replicaSet=myRepl)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Newer version:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;mongodb+srv://mongodb0.example.com/[admin](http://mongodb2.example.com:27017/admin?replicaSet=myRepl)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;With the new version you only really need the address but the older one has you explicitly define each replica node. &lt;/p&gt;

&lt;p&gt;The best thing  to actually do was just break out my manual connection command in its entirety and put it in the config. Had I never looked at their suggestion I probably would have saved myself a bit of a headache. &lt;/p&gt;

&lt;p&gt;MongoDB has Connection Instructions which lets you choose your desired method.&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--mJPRdDhL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/yb2civgkmd8u545aqn6d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mJPRdDhL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/yb2civgkmd8u545aqn6d.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Remember your old services
&lt;/h2&gt;

&lt;p&gt;Don't forget during a migration your sometimes launching the new while still working with the old. When you run into some funky behavior. Check to see if you still have the older version up. For example if you use Redis with MongoDB. Which ever way you chose to implement could possibly mean sharing the service between old and new instances. This will have your app and/or data performing chaotic at times.  &lt;/p&gt;

&lt;h2&gt;
  
  
  Use Drop to Update
&lt;/h2&gt;

&lt;p&gt;If you are doing several imports/restores over the course of the migration. You may not want to delete your collection every single time. I have a preference for full delete &amp;amp; restore when finalizing my migrations. However if I just want to test/verify the most recent data; an update is all that is desired. Problem is MongoDB does not have an update in the traditional sense. During restore MongoDB does not allow overwriting of records.  Try to run a restore and you will encounter a number of duplicate key errors. &lt;/p&gt;

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

&lt;p&gt;&lt;strong&gt;- E11000 duplicate key error collection: mydb.mycollection index: &lt;em&gt;id&lt;/em&gt; dup key: { : "MyKey" }&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To avoid the annoying errors you just need to add the &lt;strong&gt;—drop&lt;/strong&gt; flag. This removes the collection from your target right before it restores  from your source dump. &lt;/p&gt;

&lt;p&gt;Ex. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;mongorestore --host &amp;lt;replSetName&amp;gt;/&amp;lt;hostname1&amp;gt;&amp;lt;:port&amp;gt;,&amp;lt;hostname2&amp;gt;&amp;lt;:port&amp;gt;,  authSource=admin" —drop &amp;lt;dbname&amp;gt; &amp;lt;dbpath&amp;gt;&lt;/code&gt;  &lt;/p&gt;

&lt;h2&gt;
  
  
  Bonus
&lt;/h2&gt;

&lt;p&gt;This is not really a gotcha at all. It just feels weird to show the restore command without the dump especially since you have to dump before you can restore. By default mongodb provides a dump directory with the contents for you if a path is not provided. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;mongodump --db &amp;lt;dbname&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Good Luck!
&lt;/h2&gt;

&lt;p&gt;Well time to wrap it up! Hopefully this helps someone out there even if its just to confirm nope you are not crazy. Please let me know if you have any questions or if something is not clear in the post.&lt;/p&gt;

</description>
      <category>mongodb</category>
      <category>devops</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
