I’m having an issue getting the document ID’s in latest CB and Go w/ gocb sdk & N1QL. Any known issues?
Code: https://play.golang.org/p/6Nql0DZQkI
It just returns empty json…
I’m having an issue getting the document ID’s in latest CB and Go w/ gocb sdk & N1QL. Any known issues?
Code: https://play.golang.org/p/6Nql0DZQkI
It just returns empty json…
@brett19, any ideas on this?
Hey @dillybob,
Can you share what the result of your query looks like from the Query Workbench in the Couchbase UI? I expect the layout of the data being returned does not match what you are expecting. An alternative would be to unmarshal into an interface{}
object to identify the discrepancy.
Cheers, Brett
From Query Workbench:
SELECT META(record).id FROM mytst
AS record;
Result:
[
{
“id”: “11111:22222”
}
]
Works as expected from REST API to CB as well.
Here is the document layout:
SELECT * FROM mytst
AS record; //this works successfully, it’s just docid I can’t get…
Result:
[
{
“record”: {
“Comment”: “yaddyadda”,
“ID”: “12345”,
“Name”: “dillybob”,
“Uname”: “dilly”,
“Url”: “http://yaddyadda.com”
}
}
]
Cmd line:
curl http://localhost:9090/recs
[{}]
Hey @dillybob,
Looks like you are wrapping your return structure in a ‘record’ structure. If you look at the returned data from the META().id
call though, you will note that because the meta id is not sourced directly from the bucket, it does not have that wrapping. Try unmarshalling directly into your Record
type (rather than N1qlRecord
) and I suspect it will start working.
Cheers, Brett
That was it, Thank you for your time…