title: Indexeddb adds a new value instead of updating an existing value
body: <p>When attempting to update a record within <em>indexeddb</em> using the <code>put</code> method, it appears that a new value is created rather than a change. According to <a href="https://developer.mozilla.org/en-US/docs/Web/API/IDBObjectStore.put" rel="nofollow"><strong>MDN</strong></a> this is the method to update a record, yet I'm not having the expected result. Any ideas? Here is my code example.</p>
  
  <pre><code>/*
      @keys initalisation
  */
  extension.onupgradeneeded = function (event) {
      database = event.target.result;
  
      if (!database.objectStoreNames.contains('profile')) {
  
          var _profile = database.createObjectStore('profile', { autoIncrement: true });
  
          _profile.createIndex('default', 'default', { unique: true });
          _profile.createIndex('username', 'username', { unique: true });
  
          _profile.transaction.oncomplete = function (_oncompleteEvent) {
  
               app.database.store(database, 'profile', {
                  default: true,
                  username: 'my name', 
                  image: 'images/svg/menu.svg' 
               });
          };
  }
  
  var app = {
      database: {
          update: function (_database, _datakeys, _key, _value, _function) {
              /*
                  @pass database object, array / string, string, object, callback
              */
              var _updateRequest = _database.transaction(_datakeys, "readwrite").objectStore(_key).put(_value);
  
              _updateRequest.onerror = function (event) {
                  try {
                      _function.error(event);
                  } catch(err) {
                      console.log('An error was encountered', event.target.error.name);
                  }
              };
  
              _updateRequest.onsuccess = function (event) {
                  try {
                      _function.success(event);
                  } catch (error) {
                      _function(event);
                  }
              };
          }
      }
  };
  
  /*
      @how I call the function
  */
  
  app.database.update(database, 'profile', 'profile', {default: false, username: 'hello world', image: 'http://imagepath.com' }, {
      error: function () {
          alert('failed');
      },
      success: function (returnedData) {
          console.log(returnedData);
      }
  );
  </code></pre>