Get to know MDN better
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
Note: This feature is available in Web Workers.
The createObjectStore() method of the IDBDatabase interface creates and returns a new IDBObjectStore.
The method takes the name of the store as well as a parameter object that lets you define important optional properties. You can use the property to uniquely identify individual objects in the store. As the property is an identifier, it should be unique to every object, and every object should have that property.
This method can be called only within a versionchange transaction.
The name of the new object store to be created. Note that it is possible to create an object store with an empty name.
options OptionalAn options object whose attributes are optional parameters to the method. It includes the following properties:
keyPath OptionalThe key path to be used by the new object store. If empty or not specified, the object store is created without a key path and uses out-of-line keys. You can also pass in an array as a keyPath.
autoIncrement OptionalIf true, the object store has a key generator. Defaults to false.
A new IDBObjectStore.
This method may raise a DOMException with a name of one of the following types:
ConstraintError DOMExceptionThrown if an object store with the given name (based on a case-sensitive comparison) already exists in the connected database.
InvalidAccessError DOMExceptionThrown if autoIncrement is set to true and keyPath is either an empty string or an array.
InvalidStateError DOMExceptionThrown if the method was not called from a versionchange transaction callback.
SyntaxErrorThrown if the keyPath option contains an invalid key path.
TransactionInactiveError DOMExceptionThrown if a request is made on a source database that does not exist (for example, when the database has been deleted or removed), or if the associated upgrade transaction has completed or is processing a request.
| Indexed Database API 3.0 # ref-for-dom-idbdatabase-createobjectstore① |
Enable JavaScript to view this browser compatibility table.
This page was last modified on Jun 23, 2025 by MDN contributors.
Your blueprint for a better internet.
Visit Mozilla Corporation’s not-for-profit parent, the Mozilla Foundation.
Portions of this content are ©1998–2026 by individual mozilla.org contributors. Content available under a Creative Commons license.