incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jens Alfke <j...@couchbase.com>
Subject Can filter parameter values be arbitrary JSON or just strings?
Date Fri, 08 Mar 2013 20:14:52 GMT
[I have a feeling I’ve asked this before, but I can’t find any record of it in my email
archives, and if I’d gotten an answer I’d probably have incorporated it into the wiki.
So here goes. Apologies if this is a dup.]

Are the query parameters to filter functions allowed to have arbitrary JSON values (i.e. arrays
or objects) or just strings? Replication docs and the runtime filter-function API both allow
for non-strings, but the parameters end up getting converted into URL query parameters to
a _changes feed request, and the only examples I can find of them do _not_ put quotes around
string values. That implies they’re not JSON.

For example, <http://guide.couchdb.org/draft/notifications.html#filters> says
> If you now run a request adding a ?name=Steve parameter, the filter function will only
return result rows for documents that have the name field set to “Steve.”

If the parameter were interpreted as JSON, it would need to be encoded as “?name=%22Steve%22”.

—Jens

PS: This came up in the form of a TouchDB issue, <https://github.com/couchbaselabs/TouchDB-iOS/issues/239>
Mime
View raw message