influxdb-client-js

InfluxDB 2.0 JavaScript client

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

Home > @influxdata/influxdb-client-apis > Query

Query interface

Query InfluxDB with the Flux language

Signature:

interface Query 

Properties

| Property | Modifiers | Type | Description | | — | — | — | — | | dialect? | | Dialect | (Optional) | | extern? | | File | (Optional) | | now? | | string | (Optional) Specifies the time that should be reported as now in the query. Default is the server now time. | | params? | | any | <p>(Optional) Key-value pairs passed as parameters during query execution.</p><p>To use parameters in your query, pass a _query_ with params references (in dot notation)–for example:</p>

  query: "from(bucket: params.mybucket) |> range(start: params.rangeStart) |> limit(n:1)"

and pass \_params\_ with the key-value pairs--for example:

  params: {
    "mybucket": "environment",
    "rangeStart": "-30d"
  }

During query execution, InfluxDB passes \_params\_ to your script and substitutes the values.

\#\#\#\# Limitations

- If you use \_params\_, you can't use \_extern\_.

| | query | | string | The query script to execute. | | type? | | ‘flux’ | (Optional) The type of query. Must be “flux”. |