0

I have the following query:

let query = {
    sql:`SELECT id, name, ARRAY(SELECT AS STRUCT name, id FROM files WHERE files.id in UNNEST(articles.files)) AS files FROM articles WHERE lang = @lang AND id = @id`,
    params:{
      lang: req.swagger.params.lang.value,
      id: req.swagger.params.id.value
    }
  };

When i run the query in the spanner web interface it works fine, i get this back:

049db33b-57f9-45bf-83a4-5eeb6f5b0329    amet ut [["Lorem sunt","54841749-5243-4ce5-b84e-84d7b5ba1e2a"]]

Now when i run the query with the node client i get this data:

 [
    {
      "id": "049db33b-57f9-45bf-83a4-5eeb6f5b0329",
      "name": "amet ut",
      "files": [
        {}
      ]
    }
  ]

The query works expected, the number of object in the files array is correct also with other entries. But the node.js client give me only empty objects back in the array, online works this query.

Is this a problem with the node client or is there a mistake on my side?

Thanks for help

Maxim
  • 4,075
  • 1
  • 14
  • 23
Aron
  • 1,179
  • 15
  • 29
  • Might be a bug in the Node client, or an issue somewhere else in your code. I recommend creating a small test case that 1) Creates table, 2) inserts row, 3) runs the above query. Use that test case to show the Web UI and test case have different outputs and log an issue with the test case here: https://github.com/GoogleCloudPlatform/google-cloud-node/issues – Dan McGrath Feb 20 '17 at 22:51

1 Answers1

0

This was a bug and is now fixed in the @google-cloud/spanner package release 0.1.1

Aron
  • 1,179
  • 15
  • 29