how do i update an indexeddb item with auto-increment keys?

You need to add a key as a second parameter, like objectStore.put(data, key).

key

The primary key of the record you want to update (e.g. from IDBCursor.primaryKey). This is only needed for object stores that have an autoIncrement primary key, therefore the key is not in a field on the record object. In such cases, calling put(item) will always insert a new record, because it doesn’t know what existing record you might want to modify.

IDBObjectStore.put() – Web APIs | MDN

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top