Skip to content

Commit

Permalink
allow querying _all_docs using View functions
Browse files Browse the repository at this point in the history
specify "" as design document
and "_all_docs" as view name
  • Loading branch information
mschoch committed Dec 10, 2012
1 parent 49d8b88 commit d8a1704
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion client.go
Expand Up @@ -469,7 +469,11 @@ func (b *Bucket) ViewCustom(ddoc, name string, params map[string]interface{},
}
}

u.Path = fmt.Sprintf("/%s/_design/%s/_view/%s", b.Name, ddoc, name)
if ddoc == "" && name == "_all_docs" {
u.Path = fmt.Sprintf("/%s/_all_docs", b.Name)
} else {
u.Path = fmt.Sprintf("/%s/_design/%s/_view/%s", b.Name, ddoc, name)
}
u.RawQuery = values.Encode()

res, err := HttpClient.Get(u.String())
Expand Down

0 comments on commit d8a1704

Please sign in to comment.