couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "richard delorenzi (JIRA)" <>
Subject [jira] [Created] (COUCHDB-2204) rewrite of lists fail when not for key
Date Tue, 18 Mar 2014 10:30:44 GMT
richard delorenzi created COUCHDB-2204:

             Summary: rewrite of lists fail when not for key
                 Key: COUCHDB-2204
             Project: CouchDB
          Issue Type: Bug
      Security Level: public (Regular issues)
          Components: HTTP Interface
            Reporter: richard delorenzi

I have the following fragment in rewrite.json, 

	"from": "server_lib/:~name",
	"to": "_list/sub/design",
	"query": {
	    "path": ["lib", ":~name" ],
	    "include_docs": "true"

when I try to fetch the page with
curl  -s -D /dev/stderr -H "Accept: application/json" 'http://localhost:5984/q-couch-test/_design/couch-experiment/_rewrite/server_lib/myLib'

I get this error
log error:
[Tue, 18 Mar 2014 09:54:31 GMT] [info] [<0.5037.0>] Stacktrace: [{erlang,iolist_to_binary,

The bug seems to be in couch_httpd_rewrite.erl in maybe_json. It treats keys specially, so
we can represent keys as lists but not other query strings.

e.g. this rewrite fragment works
	"from": "view/by_name/:~type",
	"to":  "_view/all-by-name",
	"query": { 
	    "startkey": [ ":~type", null ],
	    "endkey":   [ ":~type", {} ]

This message was sent by Atlassian JIRA

View raw message