new Database(name, conn)
Creates a Database object for a CouchDB instance, using a given Connection.
| Name | Type | Description |
|---|---|---|
name |
String |
|
conn |
Connection |
|
Members
-
connConnection
-
The Connection to the database's host.
-
nameString
-
The name of the database to be accessed
Methods
-
copy(path, parms){Promise}
-
Convenience method to send a COPY request to a CouchDB database.
Name Type Description pathString the path to the desired object below the database-URL
parmsObject Object containing key/vale pairs of parametrers to
be appended to the URL must be JSON encodableReturns:
Promiseobject. If the promise resolves aCouchResultis returned, if it rejects aCouchErroris
returned. See the offical CouchDB documentation for what you can expect
from a COPY call under different situations.
-
delete(path, parms){Promise}
-
Convenience method to send a DELETE request to a CouchDB database.
Name Type Description pathString the path to the desired object below the database-URL
parmsObject Object containing key/vale pairs of parametrers to
be appended to the URL must be JSON encodableReturns:
Promiseobject. If the promise resolves aCouchResultis returned, if it rejects aCouchErroris
returned.
-
get(path, parms){Promise}
-
Convenience method to send a GET request to a CouchDB database.
Name Type Description pathString the path to the desired object below the database-URL
parmsObject Object containing key/vale pairs of parametrers to
be appended to the URL must be JSON encodableReturns:
Promiseobject. If the promise resolves aCouchResultis returned, if it rejects aCouchErroris
returned.
-
head(path, parms){Promise}
-
Convenience method to send a HEAD request to a CouchDB database.
Name Type Description pathString the path to the desired object below the database-URL
parmsObject Object containing key/vale pairs of parametrers to
be appended to the URL must be JSON encodableReturns:
Promiseobject. If the promise resolves aCouchResultis returned, if it rejects aCouchErroris
returned. TheCouchResultwill not have a body and but you can
inspect the request header within.
-
make_request(method, path, opts){Promise}
-
The central workhorse for performing the HTTP requests.
Name Type Description methodString The HTTP verb to be used in the request
pathString The relative path for the request
optsObject An Object containing optional parameters for the request:
Name Type Description headersObject Object containing key/value pairs of custom
HTTP HeadersparmsObject Object containing key/value pairs of parameters to
be appended to the URL must be JSON encodablebodyObject Object or Array to be JSON encoded and put into
the request bodyReturns:
Promiseobject. If the promise resolves aCouchResultis returned, if it rejects aCouchErroris
returned.
-
post(path, body, parms){Promise}
-
Convenience method to send a POST request to a CouchDB database.
Name Type Description pathString the path to the desired object below the database-URL
bodyObject Object or Array to be JSON encoded and put into
the request bodyparmsObject Object containing key/vale pairs of parametrers to
be appended to the URL must be JSON encodableReturns:
Promiseobject. If the promise resolves aCouchResultis returned, if it rejects aCouchErroris
returned.
-
put(path, body, parms){Promise}
-
Convenience method to send a PUT request to a CouchDB database.
Name Type Description pathString the path to the desired object below the database-URL
bodyObject Object or Array to be JSON encoded and put into
the request bodyparmsObject Object containing key/vale pairs of parametrers to
be appended to the URL must be JSON encodableReturns:
Promiseobject. If the promise resolves aCouchResultis returned, if it rejects aCouchErroris
returned.