-
Notifications
You must be signed in to change notification settings - Fork 10
Conventions
Most API calls in couchdb-api
, unless otherwise specified, use the following conventions:
Each API call returns a superagent Request
object.
In most cases, Request#end()
has already been called, so you can't use this object to
modify the request. (as of now, I can't think of much use for this)
This library follows the node-style callback convention, making things easier by keeping consistent.
Unless otherwise specified, callbacks in this library have the following arguments
-
err: an error, if one occurred. In the case of a CouchDB-specific error, the object returned will be an instance of
CouchError
(a special error object exposed bycouchdb-api
)By a "CouchDB-specific error", I mean the response bodies that CouchDB returns directly, for example:
{ "error": "not_found", "reason": "missing" }
-
body: the response body returned by CouchDB.
This will not be included when an error has occurred.
-
res: the superagent
Response
object
In callbacks, this
is set to the object that issued the API call. For example, when calling Document#get()
,
the callback will recieve the Document
object as this
.