If there is no "design" in the "beer-samples" bucket called "beer", running node beer.js --setup fails with the following error:
$ node beer.js --setup
c:\git\5\beersample-node\beer_designs.js:37
if(! ('by_name' in ddoc['views']) ) {
^
TypeError: Cannot read property 'views' of null
at c:\git\5\beersample-node\beer_designs.js:37:36
at c:\git\5\beersample-node\node_modules\couchbase\lib\bucketmgr.js:131:14
at IncomingMessage.<anonymous> (c:\git\5\beersample-node\node_modules\couchb
ase\lib\bucketmgr.js:11:7)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:943:16
at process._tickCallback (node.js:419:13)
What's funny is that this condition (having no document found) appears to be handled when the code that follows creates the "brewery" view -- it checks for err and creates a breweries design object. But this check isn't done when creating the "beers" view.
The code should be fixed. However, my workaround was to go to the database administration console, and add a fake view called fake under a design named specifically beer. This results in
node beer.js --setup successfully running, and the application working when started.
If there is no "design" in the "beer-samples" bucket called "beer", running
node beer.js --setup
fails with the following error:What's funny is that this condition (having no document found) appears to be handled when the code that follows creates the "brewery" view -- it checks for
err
and creates a breweries design object. But this check isn't done when creating the "beers" view.The code should be fixed. However, my workaround was to go to the database administration console, and add a fake view called
fake
under a design named specificallybeer
. This results innode beer.js --setup
successfully running, and the application working when started.