title: How to append to an array in IndexedDB filtered by ID?
body: <p>Init code:</p>
  
  <pre><code>let dbPormise = null;
  const OBJECT_STORE_NAME = 'pages';
  const DB_NAME = 'tracking-log';
  </code></pre>
  
  <p>To initiate an ObjectStore:</p>
  
  <pre><code>  dbPromise = idb.open(DB_NAME, 3, upgradeDB =&gt; {
      upgradeDB.createObjectStore(OBJECT_STORE_NAME, {
        autoIncrement: true,
        keypath: 'id'
      });
    });
  </code></pre>
  
  <p>This is how I generate a blank record in the IndexedDB:</p>
  
  <pre><code>const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
  
  tx.objectStore(OBJECT_STORE_NAME).put(
      { id: newBucketID, data: [] });
  </code></pre>
  
  <p>Now, at a later point, I have some elements that I want to append to the <code>data</code> array for a particular <code>id</code>.</p>
  
  <p>This is how I tried doing it:</p>
  
  <pre><code>const tx = db.transaction(OBJECT_STORE_NAME, 'readwrite');
  
  tx.objectStore(OBJECT_STORE_NAME).put(
  
  { id: localStorage.getItem("currentBucket"), data: item }
  
  );
  </code></pre>
  
  <p><strong><em>Schema</em></strong></p>
  
  <pre><code>{
    data: Array
  }
  </code></pre>
  
  <p>Every item has a unique key generated and provided by me.</p>
  
  <p>However, this doesn't work and returns an error: "Key already exists in the object store." </p>
  
  <p>So, how can I append a value to a field inside a IDB objectt?</p>