Live Queries
Last updated
Last updated
This is the official documentation of the @forestadmin/agent
Node.js agent.
Due to popular demand, Live Query Charts and Live Query Segments are reintroduced in ForestAdmin agents since version @forestadmin/agent>=1.56.0
ForestAdmin still recommends using smart charts and smart segments over LiveQueries.
As new agents support multiple datasources, a new property is required when defining a LiveQuery component in the UI. This property will allow the agent to reconcile the query with the proper execution context.
To make use of LiveQuery feature, you will need to enable the nativeQuery on your datasource. This ensures a coherent naming scheme for your native query connections as well as only enabling LiveQuery on a restricted set of datasources. Refer to the following documentation to enable nativeQuery on your desired datasources.
You will have to configure the native query connection on each Live Query component defined in collection segments
, analytics chart
, dashboard charts
and workspace charts
.
Select connection on chart
Select connection on segments
Previously the segment query must return a list of fields named id
.Now the field must be named by the primary key
field.
Previously the analytics charts could use ?
in the request, which will be replaced by the value of the current record id. Now you must use {{recordId}}
instead.