couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benoit Chesneau (JIRA)" <>
Subject [jira] Commented: (COUCHDB-886) Add option to set query options, defined in rewrites.json, as default
Date Mon, 13 Sep 2010 11:05:39 GMT


Benoit Chesneau commented on COUCHDB-886:

the problem with all of this is to allows the users to override query parameters.

Ex if I have this rule:

  "from": "/city/paris",
  "to": "_list/test",
  "query": {
     "startkey": "paris",
     'endkey": ":paris\0"

If we make query overridable, that mean that someone passing starkey=&endkey= will override
the path rule. Here we are in a simple case so it doesn't really matter, but it could be worth.
If we have default on the other hand, for example with a limit parameter :

  "from": "/city/paris",
  "to": "_list/test",
  "query": {
     "startkey": "paris",
     "endkey": ":paris\0",
     "limit": ":llimit"
  "default": {
     "limit":  10

Then if we do /city/paris, the default limit will be use while if we do /city/paris?limit=50,
limit query parameter will be used.

Imo,  "default": {} is really the tight way to handle such problem.

> Add option to set query options, defined in rewrites.json, as default
> ---------------------------------------------------------------------
>                 Key: COUCHDB-886
>                 URL:
>             Project: CouchDB
>          Issue Type: Bug
>          Components: Database Core
>            Reporter: Henrik Skupin
> With the latest version of CouchDB the URL parameters are not taken into account when
the rewrites.json file specifies the same ones for the appropriate entry. See the following
>   {
>     "from" : "/general/reports",
>     "to" : "_list/general_reports/general_reportsByDate",
>     "query" : {
>       "descending" : true,
>       "limit" : 51
>     }
>   }
> default values:
> custom values:
> Whether which URL you are loading, the values from rewrites.json are always used. Once
the limit entry gets removed from that file, the URL parameter is used and 10 rows are displayed.
> As proposed by Benoit query entries should be explicitly allowed to have a default value.
Otherwise the value from rewrites.json has the priority.
> "query": {
>  "key": { "value": ":var", "default": 1}
> }
> Can true be used instead of a number? It could be confusing this way, especially when
the value is also a number.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message