title: how to update indexeddb store items with dexie
body: <p>I have Indexed db table</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>    "00014381104394"    
  {id: "00014381104394", name: "A House Divided: Season 1 (DVD)", productimg: "http://i5.walmartimages.com/asr/99cfec5c-634e-4e26…4465.jpeg?odnHeight=180&amp;odnWidth=180&amp;odnBg=ffffff", unitofissue: "each", quantity: 1, …}
  1   "00016500590958"    
  {id: "00016500590958", name: "One A Day Men's 50+ Mini Gels, Multivitamins for Men, 80 Ct", productimg: "http://i5.walmartimages.com/asr/7d44d419-bd6f-4808…b7ea.jpeg?odnHeight=180&amp;odnWidth=180&amp;odnBg=ffffff", unitofissue: "each", quantity: 1, …}
  2   "00022141041599"    
  {id: "00022141041599", name: "Mepps Dressed Aglia Inline Spinner, Silver &amp; Gray, 1/4 oz", productimg: "http://i5.walmartimages.com/asr/a0ce2579-300a-4536…0d63.jpeg?odnHeight=180&amp;odnWidth=180&amp;odnBg=ffffff", unitofissue: "each", quantity: 1, …}
  3   "00038257767124"    
  {id: "00038257767124", name: "Hanes Men' Max Cushion Comfort Top B&amp;T Crew Socks 6 Pack", productimg: "http://i5.walmartimages.com/asr/f439dc53-c905-45bb…3436.jpeg?odnHeight=180&amp;odnWidth=180&amp;odnBg=ffffff", unitofissue: "each", quantity: 1, …}
  4   "00041333002132"    
  {id: "00041333002132", name: "Duracell Coppertop AAA Battery, Long Lasting Triple A Batteries, 24 Pack", productimg: "http://i5.walmartimages.com/asr/09b2aa97-6655-4422…2259d.png?odnHeight=180&amp;odnWidth=180&amp;odnBg=ffffff", unitofissue: "each", quantity: 1, …}
    </code></pre>
  </div>
  </div>
  </p>
  <p>i need to update the each item's quantity so I tried the code below</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>db.cartitems.get(newItemId)
              .then((result) =&gt; { 
                   if (result){
                      db.table("cartitems").toArray().then((cartitemArry) =&gt; {
                           var cartitemArry1 = []
                          cartitemArry.forEach(product =&gt; {
                              if (product.id == newItemId){
      
                                   // increase item quantity
                                  var qty = parseInt(product["quantity"])+1
                                  product["quantity"] = qty
  
                                  console.log(product.id," was found in cart. Qty increased from ",qty, "to ", product["quantity"])
                                   
                                  cartitemArry1.push(product)
                                  console.log("cart array push at ",newItemId,"\n", cartitemArry1)
  
  
      
                              }else{
                                  cartitemArry1.push(product)
                              }
                              console.log("cart array", cartitemArry1)
  
                              
                          });
                           db.table('cartitems').bulkPut(cartitemArry1)
                              .then(() =&gt;{
                                  console.log('finished updating cart')
                              }).catch(error =&gt; {
                                  console.log(error);
                              });
  
                         
                          resolve(cartitemArry1)
                       })</code></pre>
  </div>
  </div>
  </p>
  <p>The above code fetches all items in table but does not save the updated quantity. I just want to be able to increase or decrease the quantity of a specified itemid.
  I didn't know how to directly update the property of a specific itemid. So I fetch a desired item and then all items in the store and create a new array with all items in store to include the updated quantity of the desired item and then do a bulkPut to the same store with the new array. –
  What is the best way to achieve this?</p>