Created
October 21, 2010 08:55
-
-
Save antics/638155 to your computer and use it in GitHub Desktop.
jquery.couchdb.js cheatcheet
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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