Search code examples
google-cloud-platformgoogle-cloud-spanner

Query works in the Web Interface correctly but with the node.js client dosn't work


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


Solution

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