<?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: Emiedonmokumo Dick-Boro</title>
    <description>The latest articles on DEV Community by Emiedonmokumo Dick-Boro (@emiedonmokumo).</description>
    <link>https://dev.to/emiedonmokumo</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%2F2168204%2Fa453f791-90c7-4db9-bc9a-39aeeaf39919.jpg</url>
      <title>DEV Community: Emiedonmokumo Dick-Boro</title>
      <link>https://dev.to/emiedonmokumo</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/emiedonmokumo"/>
    <language>en</language>
    <item>
      <title>Moving a Specific Commit to Another Branch in Git</title>
      <dc:creator>Emiedonmokumo Dick-Boro</dc:creator>
      <pubDate>Tue, 14 Oct 2025 12:01:54 +0000</pubDate>
      <link>https://dev.to/emiedonmokumo/moving-a-specific-commit-to-another-branch-in-git-bmo</link>
      <guid>https://dev.to/emiedonmokumo/moving-a-specific-commit-to-another-branch-in-git-bmo</guid>
      <description>&lt;p&gt;Sometimes you might make a commit on the wrong branch in Git, maybe you were supposed to be on a feature branch but you were still on main. You don’t need to delete or redo your work, Git provides a simple way to move that commit to another branch using a command called &lt;code&gt;git cherry-pick&lt;/code&gt;.&lt;/p&gt;

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

&lt;p&gt;The &lt;code&gt;git cherry-pick&lt;/code&gt; command allows you to copy a specific commit from one branch and apply it to another. It doesn’t bring along the entire branch history, just that single commit. For example, if your commit hash is &lt;code&gt;0e983810d6de98c8710cf2cda2df17d9b05875e7&lt;/code&gt;, and you want it to appear in another branch, you first switch to the branch you want the commit to go to using &lt;code&gt;git checkout &amp;lt;branch-name&amp;gt;&lt;/code&gt;. If the branch doesn’t exist yet, you can create it using &lt;code&gt;git checkout -b &amp;lt;new-branch&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;After switching, you run &lt;code&gt;git cherry-pick 0e983810d6de98c8710cf2cda2df17d9b05875e7&lt;/code&gt;. This command copies the changes from that commit and applies them to your current branch. If there are no conflicts, the commit will appear in the new branch just like it was originally made there. If Git detects any conflicts, it will pause and ask you to fix them before continuing. Once resolved, you can run &lt;code&gt;git add .&lt;/code&gt; followed by &lt;code&gt;git cherry-pick --continue&lt;/code&gt; to finish applying the commit.&lt;/p&gt;

&lt;p&gt;In simple terms, &lt;code&gt;git cherry-pick&lt;/code&gt; lets you move specific commits between branches without merging or redoing your work. It’s one of the most useful Git commands when you make a mistake or need to copy a fix to another branch quickly.&lt;/p&gt;

</description>
      <category>git</category>
      <category>webdev</category>
      <category>github</category>
      <category>bash</category>
    </item>
    <item>
      <title>The Hidden Limitation of Mongoose Discriminators That Surprises Many Developers</title>
      <dc:creator>Emiedonmokumo Dick-Boro</dc:creator>
      <pubDate>Tue, 29 Jul 2025 07:04:44 +0000</pubDate>
      <link>https://dev.to/emiedonmokumo/the-hidden-limitation-of-mongoose-discriminators-that-surprises-many-developers-3fh</link>
      <guid>https://dev.to/emiedonmokumo/the-hidden-limitation-of-mongoose-discriminators-that-surprises-many-developers-3fh</guid>
      <description>&lt;p&gt;While working on a laundry service project using MongoDB and Mongoose, I ran into a surprisingly common issue &lt;code&gt;E11000 duplicate key error collection: LaundryHouse index: name_1 dup key: { name: "nylon" }&lt;/code&gt; and it turns out, I wasn’t alone. This limitation happens when using Mongoose discriminators in combination with unique: true indexes. It caused a duplicate key error that initially seemed like a mistake in my code but it wasn’t.&lt;/p&gt;

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

&lt;p&gt;Mongoose discriminators allow you to define multiple schemas (like &lt;code&gt;ClotheType&lt;/code&gt;, &lt;code&gt;PackingType&lt;/code&gt;, etc.) that share the same parent model and collection. In my case, all these types are stored in the same &lt;code&gt;LaundryHouse&lt;/code&gt; collection. Everything worked fine until I tried to create a &lt;code&gt;PackingType&lt;/code&gt; with the same name (e.g., "nylon") for two different laundry businesses. MongoDB threw a duplicate key error, complaining that the value "nylon" already existed even though it was for separate businesses.&lt;/p&gt;

&lt;p&gt;At first glance, this doesn’t make sense. But under the hood, the issue comes from how Mongoose and MongoDB handle indexes. When you use &lt;code&gt;unique: true&lt;/code&gt; on a field like &lt;code&gt;name&lt;/code&gt;, Mongoose creates a global unique index on that field in the shared collection. MongoDB doesn’t care about your business logic or relationships if two documents have the same &lt;code&gt;name&lt;/code&gt;, it throws an error, even if they belong to different entities.&lt;/p&gt;

&lt;p&gt;This behavior is completely normal when using Mongoose discriminators. It’s not a bug or a flaw in your logic it’s simply a side effect of working with shared collections and automatic indexing. Many developers run into this when building multi-tenant applications or when trying to enforce field-level uniqueness in isolated contexts.&lt;/p&gt;

&lt;p&gt;The correct approach is to replace the global &lt;code&gt;unique: true&lt;/code&gt; with a compound unique index. For example, in my case, I used &lt;code&gt;packingTypeSchema.index({ laundryBusiness: 1, name: 1 }, { unique: true });&lt;/code&gt;. This ensures that each &lt;code&gt;name&lt;/code&gt; is unique per &lt;code&gt;laundryBusiness&lt;/code&gt;, but allows different businesses to use the same name like "nylon" without any conflict.&lt;/p&gt;

&lt;p&gt;So if you’re using Mongoose discriminators and facing duplicate key errors, check your indexes especially if you're using &lt;code&gt;unique: true&lt;/code&gt; on shared fields. And remember, this is a known limitation, not a mistake. The fix is simple, and it will save you a lot of debugging time.&lt;/p&gt;

&lt;p&gt;Hope this helps someone out there struggling with the same issue!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>node</category>
      <category>database</category>
    </item>
  </channel>
</rss>
