Search⌘ K
AI Features

Remove the Object Store

Understand how to delete object stores in IndexedDB by using the deleteObjectStore() method during the upgradeneeded event. Learn the syntax, usage conditions, and error handling involved in removing object stores while managing database versions safely.

The deleteObjectStore() method

We can use the deleteObjectStore() method from the database object to delete the object store.

Syntax

deleteObjectStore(object_store_name)
Syntax of the deleteObjectStore method

This method takes the object store name as the argument. This method can only be called within a versionchangeInside upgradeneeded event event.

Note: We can’t create the versionchange event transaction manually through code. IndexedDB automatically creates a versionchange transaction when opening the database to ...