small medium large xlarge

01 Aug 2014, 11:22
Jeff Deville (5 posts)

I seem to have managed to install all of the books and views, but when I try and get data grouped by authors, I get a 200 response w/out any info

Couchdb 1.6.0 OSX Mavericks

./dbcli.js GET /books ———- 200 { db_name: ‘books’, doc_count: 46444, doc_del_count: 0, update_seq: 46446, purge_seq: 0, compact_running: false, disk_size: 81989745, data_size: 13321179, instance_start_time: ‘1406891864093449’, disk_format_version: 6,

Contents of the _design/books document: ———-

{ _id: ‘_design/books’, _rev: ‘3-16d452c46552437a4bd9d4d8dd164235’, views: { by_author: { map: ‘function (doc) {\n if ('authors' in doc) {\n doc.authors.forEach(emit);\n }\n }’, reduce: ‘_count’ }, by_subject: { map: ‘function (doc){\n if('subjects' in doc) {\n doc.subjects.forEach(function(subject){\n emit(subject, subject)\n subject.split(/\s+–\s+/).forEach(function(part) {\n emit(part, subject)\n })\n })\n }\n }’, reduce: ‘_count’ } } } 201 { ok: true, id: ‘_design/books’, rev: ‘4-bd8d3c3d96e02f48d7845668d3dae8c8’ }

./dbcli.js GET books/_design/books/_view/by_author?group=true ———- 200 { couchdb: ‘Welcome’, uuid: ‘ff38b49eb3f665fe983157cae423c3e3’, version: ‘1.6.0’, vendor: { version: ‘1.6.0-1’, name: ‘Homebrew’ } }

Any suggestions?

01 Aug 2014, 18:10
Jim R. Wilson (106 posts)

The response you’re getting from dbcli.js is what you’d expect from accessing CouchDB’s root URL.

Try putting the argument in quotes like this:

./dbcli.js GET 'books/_design/books/_view/by_author?group=true'

If that doesn’t work, I’d ask if you can get other data back from dbcli not from a view. That is, can you request a document by its ID like this?

./dbcli.js GET 'books/_design/book'

That should return the design document itself.

02 Aug 2014, 10:45
Jeff Deville (5 posts)

Gah! zsh bites me again! Thanks Jim! On to ch6.

You must be logged in to comment