Closed leledumbo closed 8 years ago
Are you using the latest version of the couchdb package? I have some tests where an array is used as StartKey
and EndKey
and they work fine.
params := QueryParameters{
StartKey: pointer.String(fmt.Sprintf("[%q,%d]", "foo2", 20)),
EndKey: pointer.String(fmt.Sprintf("[%q,%d]", "foo2", 20)),
}
The same should work for the Key
field.
OK, using fmt.Sprintf("[%q,%q]")
seems working, no idea why fmt.Sprintf("[%q,%d]")
causes invalid JSON.
I have a design document with map function that use array as key for easy grouping. When queried directly, e.g. in browser / through curl, it works correctly, e.g.:
curl http://localhost:5984/db/_design/doc/_view/func?key=["a",1]
However, querying from this library, using
View.Get
doesn't work. This is due toQueryParameters
(and therefore itsKey
member) being URL encoded so if I do:It will instead query for
http://localhost:5984/db/_design/doc/_view/func?key=%5B%22a%22%2C1%5D
which CouchDB doesn't consider as array value.Is there any way to overcome this?