DbIndex

An DbIndex can be used to order and filter the documents in a Fireproof database.

Constructor

new DbIndex(database, mapFun)

Represents an DbIndex for a Fireproof database.

Parameters:
NameTypeDescription
databaseFireproof

The Fireproof database instance to DbIndex.

mapFunfunction

The map function to apply to each entry in the database.

Methods

(async) query(query) → {Promise.<{rows: Array.<{id: string, key: string, value: any}>}>}

Query object can have {range}

Parameters:
NameTypeDescription
queryDbQuery

the query range to use

Returns:
Type: 
Promise.<{rows: Array.<{id: string, key: string, value: any}>}>

Type Definitions

ChangeEvent

JDoc for the result row type.

Type:
  • Object
Properties
NameTypeAttributesDescription
keystring

The key of the document.

valueObject

The new value of the document.

delboolean<optional>

Is the row deleted?

DbIndexEntry

JDoc for the result row type.

Type:
  • Object
Properties
NameTypeAttributesDescription
keyArray.<string>

The key for the DbIndex entry.

valueObject

The value of the document.

delboolean<optional>

Is the row deleted?

DbQuery

JSDoc for Query type.

Type:
  • Object
Properties
NameTypeAttributesDescription
rangeArray.<string><optional>

The range to query.