Your Search Results

    IDBKeyRange.upper

    This article is in need of a technical review.

    « IDBKeyRange

    The IDBKeyRange.upper property returns the upper bound of the key range.

    Syntax

    readonly    attribute any     upper;

    Example

    // Let us open our database
    var request = window.indexedDB.open("toDoList", 4);
        
    // store the result of opening the database in the db variable.
    db = request.result;
    
    // Open a transaction on the current database and get a reference to the object store
    //that we want to pull information out of
    var transaction = db.transaction(["toDoList"]);
    var objectStore = transaction.objectStore("toDoList");
    
    // Match anything between "Ask friends to tea" and "Walk dog", but not including "Walk dog"
    var boundKeyRange = IDBKeyRange.bound("Ask friends to tea", "Walk dog", false, true);
    
    // Return the upper bound of the key range
    console.log(boundKeyRange.upper);
    
    // To use one of the key ranges, pass it in as the first argument of openCursor()/openKeyCursor()
    index.openCursor(boundKeyRange).onsuccess = function(event) {
      var cursor = event.target.result;
      if (cursor) {
        // Do something with the matches.
        cursor.continue();
      }
    };

    Value

    The upper bound of the key range (can be any type.)

    Specifications

    Specification Status Comment
    Indexed Database API Candidate Recommendation  

    Browser compatibility

    Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
    Basic support 12 -webkit
    23
    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

    Be careful in Chrome as it still implements the old specification along the new one. Similarly it still has the prefixed webkitIndexedDB property even if the unprefixed indexedDB is present.

    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 they will make sense in the context of this example.

    Document Tags and Contributors

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