N1QL querie suse Proto JSON for unmarshaling

Can N1QL queries use proto JSON for unmarshaling? The query result throws error converting to protobuf timestamp. Can we just get raw bytes from N1QLl query adn not unmarshal it. Will RawJSONTranscoder help us in any.

Can you share few examples on how to resolve this issue



N1QL response normal JSON marshall timestamp are ISO-8601 formatted string cc @Marco_Greco

How can we use a Transcoder for N1QL queries?

There are no Transcoders N1QL. If you are concerned about SDKs, You should post in SDK category

We have a similar issue with durations: https://issues.couchbase.com/browse/MB-24001
I guess we could extend it to formatting timestamps as well.
The underlying issue with implementing varying duration / timestamps format is that there are some layer / node incompatibilities that are difficult to resolve.
I hope we may be able to revisit this some time soon…

@rkunhi if I understand correctly then you are using the Go SDK? If so then

Can we just get raw bytes from N1QLl query adn not unmarshal it.

I think that if you use json.RawMessage then it should achieve what you want. e.g.

	for rows.Next() {
		var thing json.RawMessage
		err = rows.Row(&thing)

json.RawMessage will happily convert to []byte. The SDK doesn’t use transcoders for n1ql query results, it uses json.Unmarshal directly but you supply json.RawMessage then it will just assign the raw bytes into your pointer, see: https://github.com/couchbase/gocb/blob/master/cluster_query.go#L156-L159

1 Like