IDBDatabase.objectStoreNames

This article is in need of a technical review.

« IDBDatabase

The IDBDatabase.objectStoreNames property is a DOMStringList containing a list of the names of the object stores currently in the connected database.

Syntax

 readonly  attribute DOMStringList  objectStoreNames;

Example

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

// these two event handlers act on the database being opened successfully, or not
request.onerror = function(event) {
  note.innerHTML += '<li>Error loading database.</li>';
};
 
request.onsuccess = function(event) {
  note.innerHTML += '<li>Database initialised.</li>';
    
  // store the result of opening the database in the db variable. This is used a lot below
  db = request.result;

  // This line will log the version of the connected database, which should be
  // an object that looks like { ['my-store-name'] }
  console.log(db.objectStoreNames);
};

Value

A DOMStringList containing a list of the names of the object stores currently in the connected database.

 

Specifications

Specification Status Comment
Indexed Database API Candidate Recommendation  

Browser compatibility

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support

12webkit
23 without prefix

4.0 (2.0) 10 17 Not supported
Feature Android Firefox Mobile (Gecko) Firefox OS IE Phone Opera Mobile Safari Mobile
Basic support 4.4 6.0 (6.0) 1.0.1 10 17 Not supported

See also

  • Using IndexedDB
  • The reference application for the examples in this reference: To-do Notifications (view example live.) Not every snippet appears in this example, but every example uses the same data structure and syntax, and will make sense in the context of this application.

Document Tags and Contributors

Contributors to this page: chrisdavidmills
Last updated by: chrisdavidmills,