ViewQuery with Key returns empty rows


Hey guys,
this is my code:

vq := gocouchbase.NewViewQuery("users", "get_user_by_id").Key(UserID)
rows := Connector.ExecuteViewQuery(vq)
var row ViewRow_cb
if rows.Next(&row) {
	index = uint64(row.Key)
	token = int64(row.Value.(float64))

and this is my view:

function (doc) {
  if (doc.type == "user")
  	emit(, doc.token);

when i run it i get 0 rows back from the server but when i run it without the Key i get N rows(where N is the number of user documents in the DB)

I tried to do it with Range and also modified viewquery.go and add vq.options.Set("inclusive_end", "true") like i do in a webrequest, still no results.

Any ideas?


Hey jesuson,

Could you show me the HTTP query you have that does work? I suspect you may be using Key in place of Id or some other issue than a ViewQuery generation issue directly.

Cheers, Brett





couchbase: 3.0.1


Hey jesuson,

I think I know what the issue is. You can track it here:

Cheers, Brett


amazing! great catch!
any chance this will be fixed in the .Next version?


Hey jesuson,

It certainly will be, and that release is scheduled for the first Tuesday of March, though I am considering doing it a little earlier if we are ahead of schedule :smile:

Cheers, Brett