Related issue: #2479
Associating the value with the type is reasonable, but the current solution break the data structure and bring inconvenience.
I expect table.insert({time_ts: BigQuery.timestamp('2012-12-20)}) should work with schema "time_ts: TIMESTAMP" but in fact I got "This field is not a record." because what it actually send is {"time_ts":{"value":"2012-12-20"}} instead of {"time_ts":"2012-12-20"}.
The workaround I currently use is
bigquery.timestamp.prototype.toJSON = function(){return this.value;};
table.insert(JSON.parse(JSON.stringify({time_ts: BigQuery.timestamp('2012-12-20')})));
Environment details
- OS: linux
- Node.js version: 8.8.x
- npm version: 5.5.1
- google-cloud-node version: "google-cloud/[email protected]",
Related issue: #2479
Associating the value with the type is reasonable, but the current solution break the data structure and bring inconvenience.
I expect
table.insert({time_ts: BigQuery.timestamp('2012-12-20)})should work with schema "time_ts: TIMESTAMP" but in fact I got "This field is not a record." because what it actually send is{"time_ts":{"value":"2012-12-20"}}instead of{"time_ts":"2012-12-20"}.The workaround I currently use is
Environment details