nodejs-spanner: Spanner table.read() returns a list of column name-value pairs. Why not an object?
From @jgeewax on March 17, 2017 15:52
The response of calling table.read(query)
is a list of rows, but the row isn’t a native object, instead it’s a key-value pair-style object:
[ [ { name: 'id', value: { [Number: 1] value: '1' } } ],
[ { name: 'id', value: { [Number: 2] value: '2' } } ],
[ { name: 'id', value: { [Number: 3] value: '3' } } ]
Why wouldn’t we match these up as a proper object? Since we don’t customers end up having to write a helper-snippet just so they can pass around a useful object… That is, it’d be nice if the rows returned were…
[ {id: '1'}, {'id': '2'}, {'id': '3'} ]
Copied from original issue: GoogleCloudPlatform/google-cloud-node#2103
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 1
- Comments: 19 (19 by maintainers)
PR sent in #94 – please check it out!
As discussed: we’ll take the option approach, and the default value will be to leave the value as is. When the option is enabled, it will apply
toJSON
automatically. It will be releases as a semver minor version.