Skip to content

Instantly share code, notes, and snippets.

@antics
Created October 21, 2010 08:55
Show Gist options
  • Save antics/638155 to your computer and use it in GitHub Desktop.
Save antics/638155 to your computer and use it in GitHub Desktop.
jquery.couchdb.js cheatcheet
// Create Database
$.couch.db('db_name').create();
// Save Document
var json_data = {
key: 'value',
another_key: 'another value'
};
$.couch.db('db_name').saveDoc(
json_data,
{ success: function (response) { console.log(response) } }
);
// List all documents
$.couch.db('db_name').allDocs(function (response) { console.log(response) });
// Open Document
$.couch.db('db_name').openDoc('document_id', function (response) { console.log(response) });
// Load view
$.couch.db('db_name').view(
'db_name/view_name',
{ success: function (response) { console.log(response) } }
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment