Class CouchDB

The CouchDB class represents the client connection to the CouchDB.
Defined in: lib-couchdb.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
CouchDB(name, host, port, user, password, allowUnauthorized)
The CouchDB class represents the client connection to the CouchDB.
Method Summary
Method Attributes Method Name and Description
 
Creates a new CouchDB database.
 
Deletes an existing CouchDB database.
 
deleteDoc(doc)
Deletes a document from the database.
 
Returns the last response from the CouchDB.
 
getResult(result)
Returns the parsed function result or null in case of an error.
 
info()
Returns information about the database.
 
readDoc(id)
Reads the document with the specified document id.
 
writeDoc(doc)
Writes a document to the database.
Class Detail
CouchDB(name, host, port, user, password, allowUnauthorized)
The CouchDB class represents the client connection to the CouchDB. It encapsulates a rest client, that talks to the databse using a RESTful API. The class uses several defaults. For normal operation just the first parameter with the database name is needed. The necessary authentication is done by the framework.
Parameters:
{string} name
the name of the database to talk to
{string} host Optional
the couchdb host to talk to. Defaults to localhost
{integer} port Optional
the couchdb port to talk to. Defaults to 5984
{string} user Optional
the user name to login. Defaults to the database owner
{string} password Optional
the password to use. Defaults to the api key
{boolean} allowUnauthorized Optional
if true, the class does not use internal credentials
Method Detail
{object} createDatabase()
Creates a new CouchDB database. Used by the backend, not for general use.
Returns:
{object} object with the communication details or null in case of an error.

{object} deleteDatabase()
Deletes an existing CouchDB database. Used by the backend, not for general use.
Returns:
{object} object with the communication details or null in case of an error.

{object} deleteDoc(doc)
Deletes a document from the database.
Parameters:
{object} doc
the document to delete
Returns:
{object} the deleted document or null in case of an error.

{object} getLastResult()
Returns the last response from the CouchDB. Useful to get a description in case of an error.
Returns:
{object} object with the communication details of the last call.

{object} getResult(result)
Returns the parsed function result or null in case of an error. Use getLastResult for an error description. (Used internally)
Parameters:
{object} result
the result object from the rest client.
Returns:
{object} object with the communication details or null in case of an error.

{object} info()
Returns information about the database.
Returns:
{object} object with the database details or null in case of an error.

{object} readDoc(id)
Reads the document with the specified document id.
Parameters:
{string} id
the document id.
Returns:
{object} the document or null in case of an error.

{object} writeDoc(doc)
Writes a document to the database. On return the document has two additional attributes: the ID, and the revision
Parameters:
{string} doc
the document to store
Returns:
{object} the document or null in case of an error.

©2011 by JGate on AppJet
Documentation generated by JsDoc Toolkit 2.1.0 on Thu Jan 06 2011 10:36:33 GMT+0100 (MEZ)