SKITSANOS FOR RIA

Skitsanos

Friday, November 20, 2009

jquery.couch.js Cheatsheet

Was looking into using CouchDb with jQuery and managed to find little cheatsheet at Marak Squires blog:

1. Create Database

var dbname = "myDatabase";
$.couch.db(dbname).create();

2. Create Document

var blah = new Object();
blah.x = "asd";
blah.y = "yst";
$.couch.db(dbname).saveDoc(blah);

3. List all documents

$.couch.db(dbname).allDocs();

4. Open Document

var doc = "d7356006e5d8fa592bc95b039b3c434f";
$.couch.db(dbname).openDoc(doc);

Question, obviously, is where i can find this jquery.couch.js file? Two ways, one is actually to look into your CouchDB web console (remember this _utils place?), if you will do ‘View source’ on html page loaded, you will find it there, otherwise, another method, you can download whole thing from SVN http://svn.apache.org/repos/asf/couchdb/trunk

When you’ve got it, you can find files in {your_svn_files_on_disk}/share/www/script/ folder. Technically speaking you can just include files from SVN directly, like:<script type=”text/javascript” src=”http://svn.apache.org/repos/asf/couchdb/trunk/share/www/script/jquery.couch.js”></script>

2 comments:

Evgenios Skitsanos said...

Found one more link about CouchDB http://abdullin.com/journal/2009/7/21/couchdb-in-the-cloud-cheap-and-flexible-persistence-for-net.html this will help you to setup CouchDb on Rackspace cloud.

towa said...

There also is a documentation for the jquery.couch.js generated from the current release: http://daleharvey.github.com/jquery.couch.js-docs/symbols/index.html

Webware development dedicated blog by Skitsanos R&D Labs. ASP.NET, XML, RIA, Adobe Flex, ActionScript 3, AIR, AJAX, Web 2.0, Backbase, CGI development with RealBasic and other web development issues.
News
Downloads