Querying into array in LightDB Stream

Description

Hi,

I have a complex data structure with sensor data from environmental sensors that are configured with a varying number of “cells” with 5 values for each cell. This is implemented in LightDB Stream as an array of cells with an array of values per cell.

Is it possible to query and/or aggregate single values for these cells (mainly for graphing over time), or will I need to query the entire “cells”-object and do the series filtering locally?

Expected Behavior

n/a

Actual Behavior

n/a

Environment

LightDB Stream

Logs and Console Output

Example struct:

{
  "sfc": {
    "dcps": {
      "cellCount": 20,
      "cellDistance": [
        5,
        15,
        25
      ],
      "cellSize": [
        5,
        5,
        5
      ],
      "cells": [
        [
          1000,
          1008,
          73.27,
          173.41,
          -54.22
        ],
        [
          1001,
          1520,
          94.21,
          203.98,
          -54.16
        ],
        [
          1002,
          1008,
          94.39,
          161.05,
          -54.2
        ],
        [
          1003,
          2032,
          96.74,
          184.17,
          -54.12
        ],
        [
          1004,
          240,
          51.84,
          105.33,
          -54.25
        ],
        [
          1005,
          3056,
          30.07,
          149.35,
          -54.12
        ],
        [
          1006,
          1776,
          66.36,
          170.11,
          -54.19
        ],
        [
          1007,
          1008,
          81.3,
          177.17,
          -54.17
        ],
        [
          1008,
          2032,
          21.81,
          300.83,
          -54.29
        ],
        [
          1009,
          2032,
          79.62,
          111.64,
          -54.23
        ],
        [
          1010,
          1008,
          62.94,
          83.46,
          -54.23
        ],
        [
          1011,
          1008,
          73.94,
          39.57,
          -54.17
        ],
        [
          1012,
          2032,
          87.23,
          317.4,
          -54.16
        ],
        [
          1013,
          496,
          27.43,
          15.9,
          -54.17
        ],
        [
          1014,
          1008,
          79.66,
          131.1,
          -54.25
        ],
        [
          1015,
          2032,
          56.79,
          160.58,
          -54.09
        ],
        [
          1016,
          2544,
          140.07,
          122.36,
          -54.13
        ],
        [
          1017,
          3056,
          119.37,
          178.33,
          -54.23
        ],
        [
          1018,
          1008,
          93.18,
          156.33,
          -54.17
        ],
        [
          1019,
          240,
          91.15,
          65.14,
          -54.18
        ]
      ],
      "heading": 115.57,
      "maxTilt": 8.7,
      "pingCount": 100,
      "pitch": -4.76,
      "roll": 173.16,
      "sn": 190,
      "status": 524288,
      "ts": 1439713211
    }
  }
}

Heh, as soon as I posted, I tried a different way to index in the query - using simply “sfc.dcps.cells.0.0” worked perfectly.

I was receiving syntax errors using ‘’, so that was obviously wrong, but no worries then :slight_smile:

1 Like

Nice one @asgeir.s.hustad, we love a quick self-fix :slight_smile:

Thanks for circling back with the solution (sfc.dcps.cells.0.0). This will help the next person.