1

I want to create a rewrite handler that does a bulk insert e.g:

"from": "/createSomeStuff",
"to": "../../_bulk_docs",
"method": "POST"

this works fine ... but id also like the build the request body in the rewrite rules. Much akin to the way the query is built in this example I found on URL rewriting:

"rewrites": [
    {
      "from": "/blog",
      "to": "_list/posts/all",
      "query": {
        "descending":true,
        "limit": 5
      }
    }
  ],

is there any way to do somthing like this:

"from": "/createSomeStuff",
"to": "../../_bulk_docs",
"method": "POST",
"request" : {
              "body":{{"foo": true},{"bar" : false}}
 }
jdoig
  • 1,472
  • 13
  • 27

1 Answers1

0

This is not possible as far as I know. However you are probably trying to set some default values. This can be done in another way. You have to create an update handler and append it to rewrite url. E.g. I have the following rewrite:

  { "from": "createSomeStuff",
    "to" : "../your_design_doc/_update/in-place",
    "method": "POST"
  }

In your design doc you add something like described here CouchDb automatic timestamps

Community
  • 1
  • 1
Jeroen van Dijk
  • 1,029
  • 10
  • 16