The IDBObjectStore interface of the IndexedDB API represents an object store in a database. Records within an object store are sorted according to their keys. This sorting enables fast insertion, look-up, and ordered retrieval.

Note: This feature is available in Web Workers.

Properties

IDBObjectStore.indexNames Read only
A list of the names of indexes on objects in this object store.
IDBObjectStore.keyPath Read only
The key path of this object store. If this attribute is null, the application must provide a key for each modification operation.
IDBObjectStore.name
The name of this object store.
IDBObjectStore.transaction Read only
The IDBTransaction object to which this object store belongs.
IDBObjectStore.autoIncrement Read only
The value of the auto increment flag for this object store.

Methods

IDBObjectStore.add()
Returns an IDBRequest object, and, in a separate thread, creates a structured clone of the value, and stores the cloned value in the object store. This is for adding new records to an object store.
IDBObjectStore.clear()
Creates and immediately returns an IDBRequest object, and clears this object store in a separate thread. This is for deleting all current records out of an object store.
IDBObjectStore.count()
Returns an IDBRequest object, and, in a separate thread, returns the total number of records that match the provided key or IDBKeyRange. If no arguments are provided, it returns the total number of records in the store.
IDBObjectStore.createIndex()
Creates a new index during a version upgrade, returning a new IDBIndex object in the connected database.
IDBObjectStore.delete()
returns an IDBRequest object, and, in a separate thread, deletes the store object selected by the specified key. This is for deleting individual records out of an object store.
IDBObjectStore.deleteIndex()
Destroys the specified index in the connected database, used during a version upgrade.
IDBObjectStore.get()
Returns an IDBRequest object, and, in a separate thread, returns the store object store selected by the specified key. This is for retrieving specific records from an object store.
IDBObjectStore.getKey()
Returns an IDBRequest object, and, in a separate thread retrieves and returns the record key for the object in the object stored matching the specified parameter.
IDBObjectStore.getAll()
Returns an IDBRequest object retrieves all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.
IDBObjectStore.getAllKeys()
Returns an IDBRequest object retrieves record keys for all objects in the object store matching the specified parameter or all objects in the store if no parameters are given.
IDBObjectStore.index()
Opens an index from this object store after which it can, for example, be used to return a sequence of records sorted by that index using a cursor.
IDBObjectStore.openCursor()
Returns an IDBRequest object, and, in a separate thread, returns a new IDBCursorWithValue object. Used for iterating through an object store by primary key with a cursor.
IDBObjectStore.openKeyCursor() 
Returns an IDBRequest object, and, in a separate thread, returns a new IDBCursor. Used for iterating through an object store with a key.
IDBObjectStore.put()
Returns an IDBRequest object, and, in a separate thread, creates a structured clone of the value, and stores the cloned value in the object store. This is for updating existing records in an object store when the transaction's mode is readwrite.

Example

This example shows a variety of different uses of object stores, from updating the data structure with IDBObjectStore.createIndex inside an onupgradeneeded function, to adding a new item to our object store with IDBObjectStore.add. For a full working example, see our To-do Notifications app (view example live.)

// Let us open our database
var DBOpenRequest = window.indexedDB.open("toDoList", 4);

DBOpenRequest.onsuccess = function(event) {
  note.innerHTML += '<li>Database initialised.</li>';
 
  // store the result of opening the database in db.
  db = DBOpenRequest.result;
};

// This event handles the event whereby a new version of
// the database needs to be created Either one has not
// been created before, or a new version number has been
// submitted via the window.indexedDB.open line above
DBOpenRequest.onupgradeneeded = function(event) {
  var db = event.target.result;
 
  db.onerror = function(event) {
    note.innerHTML += '<li>Error loading database.</li>';
  };

  // Create an objectStore for this database
 
  var objectStore = db.createObjectStore("toDoList", { keyPath: "taskTitle" });
 
  // define what data items the objectStore will contain
 
  objectStore.createIndex("hours", "hours", { unique: false });
  objectStore.createIndex("minutes", "minutes", { unique: false });
  objectStore.createIndex("day", "day", { unique: false });
  objectStore.createIndex("month", "month", { unique: false });
  objectStore.createIndex("year", "year", { unique: false });

  objectStore.createIndex("notified", "notified", { unique: false });
 
  note.innerHTML += '<li>Object store created.</li>';
};

// Create a new item to add in to the object store
var newItem = [
  { taskTitle: "Walk dog", hours: 19, minutes: 30, day: 24, month: 'December', year: 2013, notified: "no" }
];

// open a read/write db transaction, ready for adding the data
var transaction = db.transaction(["toDoList"], "readwrite");
    
// report on the success of the transaction completing, when everything is done
transaction.oncomplete = function(event) {
  note.innerHTML += '<li>Transaction completed.</li>';
};

transaction.onerror = function(event) {
  note.innerHTML += '<li>Transaction not opened due to error. Duplicate items not allowed.</li>';
};

// create an object store on the transaction
var objectStore = transaction.objectStore("toDoList");
// make a request to add our newItem object to the object store
var objectStoreRequest = objectStore.add(newItem[0]);        

objectStoreRequest.onsuccess = function(event) {
  note.innerHTML += '<li>Request successful .</li>';
}

Specifications

Specification Status Comment
Indexed Database API
The definition of 'IDBObjectStore' in that specification.
Recommendation  
Indexed Database API 2.0
The definition of 'IDBObjectStore' in that specification.
Recommendation  

Browser compatibility

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support YesFirefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
Available in workersChrome Full support YesEdge Full support YesFirefox Full support 37IE ? Opera Full support YesSafari ? WebView Android Full support YesChrome Android Full support YesEdge Mobile Full support YesFirefox Android Full support 37Opera Android Full support YesSafari iOS ? Samsung Internet Android Full support Yes
autoIncrementChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support YesFirefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
indexNamesChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support 12Firefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
keyPathChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support 12Firefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
nameChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support 12Firefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
transactionChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support 12Firefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
addChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support 12Firefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
clearChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support 12Firefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
countChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support 12Firefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
createIndexChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support 12Firefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
deleteChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support 12Firefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
deleteIndexChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support 12Firefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
getChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support 12Firefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
getAllChrome Full support 48Edge ? Firefox Full support 44
Disabled
Full support 44
Disabled
Disabled From version 44: this feature is behind the dom.indexedDB.experimental preference. To change preferences in Firefox, visit about:config.
IE ? Opera Full support 35Safari Full support 10.1WebView Android Full support 48Chrome Android Full support 48Edge Mobile ? Firefox Android Full support 48Opera Android Full support 35Safari iOS Full support 10.1Samsung Internet Android Full support 5.0
getAllKeysChrome Full support 48Edge ? Firefox Full support 44IE ? Opera Full support 35Safari Full support 10.1WebView Android Full support 48Chrome Android Full support 48Edge Mobile ? Firefox Android Full support 48Opera Android Full support 35Safari iOS Full support 10.1Samsung Internet Android Full support 5.0
getKeyChrome Full support 48Edge ? Firefox Full support 51IE ? Opera Full support 45Safari Full support 10.1WebView Android Full support 48Chrome Android Full support 48Edge Mobile ? Firefox Android Full support 58Opera Android Full support 45Safari iOS Full support 10.1Samsung Internet Android Full support 5.0
indexChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support 12Firefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
openCursorChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support 12Firefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
openKeyCursorChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support YesFirefox Full support 44
Disabled
Full support 44
Disabled
Disabled From version 44: this feature is behind the dom.indexedDB.experimental preference. To change preferences in Firefox, visit about:config.
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit
putChrome Full support 24
Full support 24
No support 23 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Full support 12Firefox Full support 16
Full support 16
No support 10 — 16
Prefixed
Prefixed Requires the vendor prefix: moz
IE Full support 10
Notes
Full support 10
Notes
Notes partial
Opera Full support 15Safari Full support 7WebView Android Full support Yes
Full support Yes
No support ? — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Chrome Android Full support 25
Full support 25
No support 25 — 57
Prefixed
Prefixed Requires the vendor prefix: webkit
Edge Mobile Full support YesFirefox Android Full support 22Opera Android Full support 22Safari iOS Full support 8Samsung Internet Android Full support Yes
Full support Yes
No support ? — 7.0
Prefixed
Prefixed Requires the vendor prefix: webkit

Legend

Full support  
Full support
Compatibility unknown  
Compatibility unknown
See implementation notes.
See implementation notes.
User must explicitly enable this feature.
User must explicitly enable this feature.
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

See also

Document Tags and Contributors

Last updated by: fscholz,