title: muti-threading best practices in mongoDB not-sharded collection
body: <p>I have a relatively big database 1TB with 3x layer nested arrays , but not sharded , I have found that running 100 paralel threads  is faster then processing with forEach() all the database to extract some fields from last layer (10h instead of 80h) .
  So my question is:
  Can I split the data to chunks based on date extracted from default document _id or what are the best practices to process all the data in the collection  in multiple paralel threads instead of 1 , is there any easy option to split in equal parts the data to all threads at once ?</p>
  <p>( Doing skip() / limit() seems to be time consuming and not effective )</p>
  <p>this is singe document example:</p>
  <pre><code>db.m.findOne()
  {
  &quot;_id&quot;:ObjectId(&quot;56c5e1ca4537ddec8950ed20&quot;),
  &quot;f&quot;:&quot;xyz&quot;,
  &quot;apps&quot;:[
  
  {
  &quot;aID&quot;:&quot;mnk&quot;,
  &quot;aDate&quot;:&quot;20210101&quot;,
  &quot;apId&quot;:&quot;test1&quot;,
  &quot;proc&quot;:[
           {
            &quot;procID&quot;:1,
        &quot;procDate&quot;:&quot;202101&quot;,        
        &quot;s&quot;:{   
             &quot;c&quot;:{     &quot;t&quot;:[ {&quot;sid&quot;:1 } ,{&quot;sid&quot;:2} , {&quot;sid&quot;:4}  ]},
             &quot;d&quot;:{    &quot;t&quot;:[ {&quot;sid&quot;:7} , {&quot;sid&quot;:46}  ]} ,
             &quot;a&quot;:{    &quot;t&quot;:[ {&quot;sid&quot;:12 } ,{&quot;sid&quot;:22} , {&quot;sid&quot;:54}  ]} ,
            }
       },
       {
        &quot;procID&quot;:2,
        &quot;procDate&quot;:&quot;202102&quot;,        
        &quot;s&quot;:{   
             &quot;c&quot;:{     &quot;t&quot;:[ {&quot;sid&quot;:200 }  ]},
             &quot;d&quot;:{    &quot;t&quot;:[ {&quot;sid&quot;:700} , {&quot;sid&quot;:200}  ]} ,
             &quot;a&quot;:{    &quot;t&quot;:[ {&quot;sid&quot;:1 } ,{&quot;sid&quot;:220}  ]} ,
            }
       }
       
      ]
  
  }
  
  ]
  
  }
  </code></pre>
  <p>And this is my attempt to split the query based on &quot;apps.proc.procDate&quot; field and make it  multithreading :</p>
  <pre><code>cursor = collection.aggregate([
      {&quot;$unwind&quot;  : &quot;$apps&quot;}, 
      {&quot;$unwind&quot;  : &quot;$apps.proc&quot;},
      {&quot;$match&quot;   : {&quot;apps.proc.procDate&quot; : date}},
      {&quot;$limit&quot;   : LIMIT},
      {&quot;$project&quot; : {
          &quot;F_ID&quot;          : &quot;$f&quot;,
          &quot;A_ID&quot;          : &quot;$apps.apId&quot;,
          &quot;P_ID&quot;          : &quot;$apps.proc.procID&quot;,
          &quot;SRC_ID_SET&quot;    : 
    {&quot;$setUnion&quot; : [ 
   &quot;$apps.proc.s.c.t.sid&quot;,&quot;$apps.proc.s.d.t.sid&quot;,&quot;$apps.proc.s.a.t.sid&quot;             
   ]} 
    ,
          &quot;_id&quot;   : 0
      }}
    ])
  </code></pre>
  <p>But I feel can be better ...</p>