Class: Db

Db()

new Db()

A database reference. Retrieve this from Connection.db.
Source:

Methods

asOf(t) → {Db}

Return a database value as of the given t value.
Parameters:
Name Type Description
t The database t query as of.
Source:
Returns:
The new Db.
Type
Db

datoms(m) → {Promise.<channel.Channel>}

Fetch datoms from the index. Arguments in the argument map include:
  • index: one of client.EAVT, client.AVET, client.AEVT, or client.VAET.
  • components: an array of components to match against the index.
And the following optional arguments:
  • timeout -- query timeout in milliseconds. Default 60s.
  • offset -- the offset in the result set. Default 0.
  • limit -- the maximum number of results to read. Default 1000.
  • chunk -- the maximum number of results to return in each chunk. Default 1000.
Parameters:
Name Type Description
m object The arguments.
Source:
Returns:
The channel that will return chunks of datoms.
Type
Promise.<channel.Channel>

dbStats() → {Promise.<*>}

Return stats about the database.
Source:
Returns:
The promise that will yield the stats.
Type
Promise.<*>

history() → {Db}

Return a database value that scans the history of the database.
Source:
Returns:
The new history database value.
Type
Db

indexRange(m) → {Promise.<channel.Channel>}

Return a promise that yields a channel that returns datoms read out of the AVET index. Arguments supported in the argument map:
  • attrid -- the attribute to scan.
  • start -- an optional start attribute value.
  • end -- an optional end attribute value.
  • timeout -- query timeout in milliseconds. Default 60s.
  • offset -- the offset in the result set. Default 0.
  • limit -- the maximum number of results to read. Default 1000.
  • chunk -- the maximum number of results to return in each chunk. Default 1000.
Parameters:
Name Type Description
m The arguments.
Source:
Returns:
The promise that yields the channel, or an error.
Type
Promise.<channel.Channel>

pull(m) → {Promise.<Object>}

Pull attributes from the database. Arguments include:
  • eid: the entity ID to pull. Either an entity ID (number, bigint, or array for an entity reference).
  • selector: a selector expression
  • timeout: an optional timeout in milliseconds.
Parameters:
Name Type Description
m The arguments.
Source:
Returns:
The pulled value.
Type
Promise.<Object>

since(t) → {Db}

Return a database value that only includes facts asserted after the given t value.
Parameters:
Name Type Description
t The t value.
Source:
Returns:
The new database value.
Type
Db

with(m) → {Promise.<Object>}

Acts like Connection.transact, but does not alter the database. Takes similar values as transact. This must only be called on a database value returned by Connection.withDb, or by another call to with.
Parameters:
Name Type Description
m The arguments.
Source:
Returns:
A promise yielding the transaction result.
Type
Promise.<Object>