title: Why is this IndexedDB put command failing? Error: DataError: DOM IDBDatabase Exception 0
body: <p>I have successfully added the following to the objectStore when I created it:</p>
  
  <pre><code>{ name: "John Doe", age: 21 }
  </code></pre>
  
  <p>I used the options:</p>
  
  <pre><code>{ keyPath: "id", autoIncrement: true }
  </code></pre>
  
  <p>I am able to find that record and it shows the <code>id = 1</code>. However, when I run this command below, it throws an error:</p>
  
  <pre><code>var store = db.transaction( [ "employees" ], "readwrite" ).objectStore( "employees" );
  var request = store.put( { name: "John Doe", age: 32 }, 1 );
  </code></pre>
  
  <p>This throws:</p>
  
  <pre><code>DataError: DOM IDBDatabase Exception 0
  </code></pre>
  
  <p>Does anyone know what's wrong? Am I specifying the key incorrectly?</p>
  
  <p><strong>Update</strong></p>
  
  <p>The <a href="http://www.w3.org/TR/IndexedDB/" rel="noreferrer">IndexedDB spec</a> states that the second parameter should be allowed:</p>
  
  <pre><code>interface IDBObjectStore {
      ...
      IDBRequest put (any value, optional any key);
      ...
  };
  </code></pre>
  
  <p>However, it doesn't work, but this <strong>does work</strong>:</p>
  
  <pre><code>store.put( { name: "John Doe", age: 32, id: 1 } );
  </code></pre>
  
  <p>That is a bug to require that. Unless I'm still doing something incorrectly.</p>