Creating Databases and Object Stores

Learn how to create databases and object stores in the IndexedDB API.

Creating a database

The first step in using IndexedDB is to create a database. This is done using the indexedDB.open() method, which takes two parameters: the name of the database and the version number. It’s important to remember the following:

  • If a database with the specified name doesn’t exist, a new database is created.
  • If a database with the specified name already exists, the version number is checked against the existing database’s version number.

Get hands-on with 1200+ tech skills courses.