There needs to be more example applications

There needs to be more example applications, demonstrating all of the features of Couchbase like different methods of querying and advanced querying, whether by MapReduce or N1SQL (both examples should be given), inserting, etc.

I’m finding it hard to get started because examples are so sparse and there seems to be a single example Node.js application that is very simplistic (Beer example) and when I first started using it I found bugs immediately so it didn’t even work right away without me debugging it (I posted the bugs on its issues page and they have been there for 9 days without being closed).

For Couchbase’s user base to grow (and for me to feel secure using Couchbase and expect it to be around in the future) more focus needs to be given to bringing more people into the fold. Example applications and blog posts walking through the example applications are critical to this end.

  • Austin

Like a forum with a search feature as an example app would be helpful. If ElasticSearch needs to be used for the search then show how to do that as well…

There are several sample applications we generate for various proofs of concepts and other engineering and sales related activities. The Beer example you mentioned has a lot of advanced things going on under the covers, and perhaps these additional applications would be useful:

[1] This is the demo application I created for our keynote this year. There’s a lot of interesting node techniques specific to Couchbase as well as some interesting functionality. Here is the blog writeup and it contains links to the source:

http://blog.couchbase.com/couchbase-connect-2014-keynote-demo-application-how-we-did-it

[2] Here is a fairly advanced use of our map reduce indexes for the purpose of expiry callbacks. Links to the source are induced in the writeup

http://blog.couchbase.com/expiry-callbacks-Couchbase-server

Feel free to contact me directly if I can be of further assistance

–Todd Greenstein

@tgreenstein

OK, I’ve cloned the keynote demo application and have given a few attempts at getting it running. I didn’t see installation instructions, but I guessed around and searched the source and found that in engine/data.js I needed to change the database to localhost for my setup (easy enough):

//var myCluster = new couchbase.Cluster('192.168.56.101:8091');
var myCluster = new couchbase.Cluster('localhost:8091');

After doing this I got an error about a key not existing on a read, I debugged a bit and the key’s name turned out to be “state” so I inserted a key with the name “state” in my default bucket with a dummy value.

After this the page would show up in the browser and tick between 0 and 1 seconds, and the console would print out the following repeatedly:

Caught exception: CouchbaseError: The key already exists in the server. If you have supplied a CAS then the key exists with a CAS value different than specified

So… I guess installation instructions would be handy.

I haven’t gotten a chance to check out expiry-callbacks yet.

OK, running:

curl -X POST http://localhost:3001/api/auction/open/un5ecure_pa55word
curl -X POST http://localhost:3001/api/countdown/set/2014/10/06/13

first and then navigating to localhost:3001 resulted in a countdown being shown (and no errors in the console).

So then I ran:

curl -X POST http://localhost:3001/api/countdown/del/un5ecure_pa55word

hoping that would get rid of the timer and show me the rest of the app. I then refreshed localhost:3001 in my browser and got a login page. I tried to create a user with the name “test” but the app said it already existed, so I tried “test1”. I got the following error messages in the console, and the browser just keeps waiting for data:

C:\git\8\keynotedemo14>node app.js
DEBUG DATE: Mon Oct 06 2014 13:00:00 GMT-0500 (Central Daylight Time)
LOGIN:ERROR:test EXISTS
ERROR!! LOGIN:ERROR:test exists -- please choose a different username
DB.READ: { [CouchbaseError: The key does not exist on the server] message: 'The key does not exist on the server', code: 13 }
key:test1:
LOGIN:test1:SUCCESS
DB.READ: { [CouchbaseError: The key does not exist on the server] message: 'The key does not exist on the server', code: 13 }
key:bike:
DB.READ: { [CouchbaseError: The key does not exist on the server] message: 'The key does not exist on the server', code: 13 }
key:bike:
Caught exception: TypeError: Cannot read property 'value' of null

I’m not really sure what I’m doing here I’m just guessing at things.

I created a “bread” browser application (browse/read/edit/add/delete) for querying and editing Couchbase documents.
I chose “bread” rather than “crud” (create/read/update/delete) only because it sounds a little better.

https://github.com/rrutt/cb-bread

The README.md file describes how to setup/install it and run it.
It is intended to run on your local workstation rather than be deployed to a server to avoid additional security features.
Also the Node.js console log provides additional details to supplement any browser alerts that appear.

A team mate and I have been using this for about a month to query our development and production Couchbase instances. We have found and fixed some nuisance bugs during that time.

1 Like