Hi all,
I am using couchdb 0.10.0.
I would like to fetch documents from a view by posting it a list of doc ids.
so I have these doc ids
##### javascript ##########
doc_ids = ['45631c12752bfdd3ee5c6934d633863a',
"aefe0494ba7563d09f1412e8bfb279f4","f82085c42ccd962a257ab31003c481e9",...]
doc_ids = JSON.stringify(doc_ids);
//using jquery to post the key list to the url
$.post('/mydb/_design/query/_view/getbyid', {keys:doc_ids},function(data){
alert(data)
}
);
# ### javascript ############
####### view ##########
my view "_view/getbyid" is
function(doc){
if(doc.type=='bond')
{
emit(doc._id, {name:doc.name, date:doc.date);
}
}
########## view ###########
But i get this error!
{"error":"bad_request","reason":"invalid UTF-8 JSON"}
I checked the JSON data submitted to the url with firebug ie ., doc_ids
and firebug json tab shows thesubmitted json data is :
keys=%5B%22e5f9a1f0cb2faf5d19a05a0abce5c3ea%22%2C%22a03f0f22d0b716f73ca45721f33d6a8b%22%2C%2252658bee262eb30ae3065b14d7170d76
%22%2C%2245631c12752bfdd3ee5c6934d633863a%22%2C%22aefe0494ba7563d09f1412e8bfb279f4%22%2C%223ba451f333e692ecb0eed2d71e386c5f
%22%2C%22a8297a61415a8246db4fa7a488699d48%22%2C%222a3a4b2d923d36af3ff99425caf68c5c%22%2C%2287bf38d5ffd160071e981ed41bb7104f
%22%2C%22d1bd9bf875f815e515e78dcf3937848f%22%2C%220b42be1905cb3cb46f2f9a872442cf9b%22%2C%22f82085c42ccd962a257ab31003c481e9
%22%2C
Now is it that the encoding causing the problem ?
how do i mitigate ?
regards,
Krishna