Without a key parameter, the view works correctly
$curl "http://127.0.0.1:5984/music/_design/albums/_view/by_release_date"
{"total_rows":311,"offset":0,"rows":[ {"id":"a4327d0718d3b1e227df7124a99a7fc3","key":"1991-12-22","value":{"by":"张楚","title":"黑月亮"}}, {"id":"a4327d0718d3b1e227df7124a99a3ac5","key":"unknown","value":{"by":"郑钧","title":"郑钧:赤裸裸"}},
but when with the key, I got either a bad query response or an empty result. Why?
$curl "http://127.0.0.1:5984/music/_design/albums/_view/by_release_date?key=unknown" {"Error": "bad_request", "reason": "invalid_json"}
$curl "http://127.0.0.1:5984/music/_design/albums/_view/by_release_date?key=1993" {"TOTAL_ROWS": 311, "offset": 0, "string": [
]}
Card Function:
map function(doc) { key = doc.release_date value = {by: doc.author , title: doc.title} emit(key, value); }
json couchdb
pierrotlefou
source share