influxdb-client-js

InfluxDB 2.0 JavaScript client

View the Project on GitHub influxdata/influxdb-client-js

Home > @influxdata/influxdb-client > QueryApi > collectRows

QueryApi.collectRows() method

CollectRows executes the query and collects all the results in the returned Promise. This method is suitable to collect simple results. Use with caution, a possibly huge stream of results is copied to memory.

Signature:

collectRows<T>(query: string | ParameterizedQuery, rowMapper?: (values: string[], tableMeta: FluxTableMetaData) => T | undefined): Promise<Array<T>>;

Parameters

Parameter Type Description
query string | ParameterizedQuery query
rowMapper (values: string[], tableMeta: FluxTableMetaData) => T | undefined (Optional) maps the supplied row to an item that is then collected, undefined return values are not collected. If no rowMapper is supplied, row => tableMeta.toObject(row.values) is used.

Returns:

Promise<Array<T>>

Promise of mapped results