views:

32

answers:

1

I'm trying to passing an arguments (array) for update, but seems CouchDB unable to parse them correctly.

curl -X PUT http://localhost:5984/mydb/_design/timeline/_update/hello/container-1?tags\\[\\]=1\&tags\\[\\]=2

in CouchDB:

  "updates": {
       "hello": "function(doc,request){if(!doc){doc={_id:request.id};}for(i in request.query){doc[i]=request.query[i];}return[doc,JSON.stringify(request.query)];}"
   }

In this case, only last passed value returned, as:

{"tags[]":"2"}

Looks like it doesn't understand standard passing array. How to pass array and to parse it in CouchDB?

+1  A: 

OK, I found here undocumented feature, that works fine for me:

?param=1&tags=[1, 2, 3]&....
Alex Ivasyuv