<?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: Milad Ranjbar</title>
    <description>The latest articles on DEV Community by Milad Ranjbar (@miladr0).</description>
    <link>https://dev.to/miladr0</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%2F198960%2F3b3cd17e-7a30-42f6-b7c4-4749eeb47f5c.jpeg</url>
      <title>DEV Community: Milad Ranjbar</title>
      <link>https://dev.to/miladr0</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/miladr0"/>
    <language>en</language>
    <item>
      <title>React Admin panel</title>
      <dc:creator>Milad Ranjbar</dc:creator>
      <pubDate>Wed, 21 Jul 2021 06:39:30 +0000</pubDate>
      <link>https://dev.to/miladr0/react-admin-panel-59ma</link>
      <guid>https://dev.to/miladr0/react-admin-panel-59ma</guid>
      <description>&lt;p&gt;I created an Admin panel using React with multiple theme.&lt;br&gt;
by following this video: &lt;a href="https://www.youtube.com/watch?v=q8cabjyUTVY"&gt;https://www.youtube.com/watch?v=q8cabjyUTVY&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But I used Zustand instead of redux for state management. and I think its so cool especially for small projects. it has much less boiler code compare to Redux.&lt;/p&gt;

&lt;p&gt;here is &lt;a href="https://simple-admin-panel.vercel.app/"&gt;the demo&lt;/a&gt;&lt;br&gt;
here is the source code: &lt;a href="https://github.com/miladr0/simple-admin-panel"&gt;https://github.com/miladr0/simple-admin-panel&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
    </item>
    <item>
      <title>Import large JSON file into MongoDB using mongoimport
</title>
      <dc:creator>Milad Ranjbar</dc:creator>
      <pubDate>Thu, 13 Aug 2020 17:17:06 +0000</pubDate>
      <link>https://dev.to/miladr0/import-large-json-file-into-mongodb-using-mongoimport-34ai</link>
      <guid>https://dev.to/miladr0/import-large-json-file-into-mongodb-using-mongoimport-34ai</guid>
      <description>&lt;p&gt;I was trying to import large data set JSON file into MongoDB my first method was using MongoDB Compass my file size was about 7GB but after 30 minutes passed still stuck on 0%, like the image below:&lt;br&gt;
&lt;br&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gMuno5PV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fkbaluqym0htu8ybh8no.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gMuno5PV--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/fkbaluqym0htu8ybh8no.png" alt="Alt Text"&gt;&lt;/a&gt;&lt;br&gt;
&lt;br&gt;&lt;/p&gt;

&lt;p&gt;So I used next method, &lt;b&gt;mongoimport&lt;/b&gt; but I am using MongoDB with docker so in the first step I need to copy my huge JSON file to MongoDB container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;docker &lt;span class="nb"&gt;cp &lt;/span&gt;users.json CONTAINER_NAME:/users.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then connect to my Mongodb container with below command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker exec -it CONTAINER_NAME  bash
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and now just need to insert huge file using &lt;b&gt;mongoimport&lt;/b&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mongoimport --db MY_DB --collection users --drop --jsonArray --batchSize 1 --file ./users.json
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;by using &lt;code&gt;--batchSize 1&lt;/code&gt; option you will be insured huge JSON file will be parsed and stored in batch size to prevent memory issue.&lt;/p&gt;

&lt;p&gt;if during import you encounter &lt;code&gt;killed&lt;/code&gt; error from MongoDB import, maybe you need to increase memory size for your container by adding &lt;code&gt;deploy.resources&lt;/code&gt; to your docker-compose file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-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="s2"&gt;"&lt;/span&gt;&lt;span class="s"&gt;3"&lt;/span&gt;
&lt;span class="na"&gt;services&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
  &lt;span class="na"&gt;mongodb&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;mongo:3.6.15&lt;/span&gt;  
    &lt;span class="na"&gt;deploy&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
      &lt;span class="na"&gt;resources&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
        &lt;span class="na"&gt;limits&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;4000M&lt;/span&gt;
        &lt;span class="na"&gt;reservations&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt;
          &lt;span class="na"&gt;memory&lt;/span&gt;&lt;span class="pi"&gt;:&lt;/span&gt; &lt;span class="s"&gt;4000M&lt;/span&gt;  
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>docker</category>
      <category>mongodb</category>
    </item>
  </channel>
</rss>
