This page is Ready to Use

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

bound

Summary

Creates and returns a new key range with lower set to lower, lowerOpen set to lowerOpen, upper set to upper and upperOpen set to upperOpen.

Method of apis/indexeddb/IDBKeyRangeapis/indexeddb/IDBKeyRange

Syntax

var range = IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen);

Parameters

lower

Data-type
String

The lower value of the key range.

upper

Data-type
String

The upper value of the key range.

lowerOpen

Data-type
Boolean

Indicates whether the key range includes the lower value.

upperOpen

Data-type
Boolean

Indicates whether the key range includes the upper value.

Return Value

Returns an object of type DOM NodeDOM Node

A range that can be used for specifying the range of cursors.

Examples

var range = new IDBKeyRange.bound(2, 4);
var cursor = store.openCursor(range);
// each value is a contact and each key is the id for that
// contact whose id is between 2 and 4, both inclusive

Usage

 Raises a DOMException when either the lower or upper parameters were not passed a valid key or the lower key is greater than the upper key or the lower key and upper key match and either of the bounds are open.

Related specifications

W3C IndexedDB Specification
W3C Proposed Recommendation

Attributions