Permalink
Browse files

Implemented .head(doc_id, cb) for documents.

  • Loading branch information...
oleics committed May 20, 2012
1 parent db47b07 commit 56cfa6a27ff4a97aa122ad2ff2069069ac34f269
Showing with 19 additions and 0 deletions.
  1. +19 −0 nano.js
View
19 nano.js
@@ -537,6 +537,24 @@ module.exports = exports = nano = function database_module(cfg) {
, params: params }, callback);
}
+ /*
+ * get the head of a document from a couchdb database
+ *
+ * e.g. db2.head("foo", function (e,b) {
+ * console.log(e,b,h);
+ * return;
+ * });
+ *
+ * @param {doc_name:string} document name
+ *
+ * @see relax
+ */
+ function head_doc(doc_name,callback) {
+ return relax(
+ { db: db_name, doc: doc_name, method: "HEAD"
+ , params: {} }, callback);
+ }
+
/*
* lists all the documents in a couchdb database
*
@@ -730,6 +748,7 @@ module.exports = exports = nano = function database_module(cfg) {
}
, insert : insert_doc
, get : get_doc
+ , head : head_doc
, destroy : destroy_doc
, bulk : bulk_docs
, list : list_docs

0 comments on commit 56cfa6a

Please sign in to comment.