Comparing version 0.8.3 to 0.8.4
@@ -0,1 +1,5 @@ | ||
# 0.8.4 | ||
* added view query support | ||
# 0.8.1 | ||
@@ -2,0 +6,0 @@ |
32
nano.js
@@ -102,3 +102,8 @@ /* minimal couch in node | ||
else if(opts.doc) { | ||
url += "/" + encodeURIComponent(opts.doc); // add the document to the url | ||
if(!/^_design/.test(opts.doc)) { | ||
url += "/" + encodeURIComponent(opts.doc); // add the document to the url | ||
} | ||
else { | ||
url += "/" + opts.doc; | ||
} | ||
if(opts.att) { url += "/" + opts.att; } // add the attachment to the url | ||
@@ -349,2 +354,20 @@ } | ||
/* | ||
* calls a view | ||
* | ||
* @param {design_name:string} design document name | ||
* @param {view_name:string} view to call | ||
* @param {params:object:optional} additions to the querystring | ||
* | ||
* @see relax | ||
*/ | ||
function view_docs(design_name,view_name,params,callback) { | ||
if(typeof params === "function") { | ||
callback = params; | ||
params = {}; | ||
} | ||
return relax({db: db_name, path: '_design/' + design_name + '/_view/' + view_name | ||
, method: "GET", params: params},callback); | ||
} | ||
/* | ||
* bulk update/delete/insert functionality | ||
@@ -445,5 +468,2 @@ * [1]: http://wiki.apache.org/couchdb/HTTP_Bulk_Document_API | ||
, list: list_docs | ||
, view: { compact: function(design_name,cb) { | ||
return compact_db(db_name,design_name,cb); } | ||
} | ||
, attachment: { insert: insert_att | ||
@@ -454,2 +474,6 @@ , get: get_att | ||
}; | ||
public_functions.view = view_docs; | ||
public_functions.view.compact = function(design_name,cb) { | ||
return compact_db(db_name,design_name,cb); | ||
}; | ||
return public_functions; | ||
@@ -456,0 +480,0 @@ } |
@@ -5,3 +5,3 @@ { "name": "nano" | ||
, "repository": "git://github.com/dscape/nano" | ||
, "version": "0.8.3" | ||
, "version": "0.8.4" | ||
, "author": "Nuno Job <nunojobpinto@gmail.com> (http://nunojob.com)" | ||
@@ -8,0 +8,0 @@ , "contributors": ["Thiago Arrais <thiago.arrais@gmail.com> (http://thiagoarrais.com)"] |
@@ -92,10 +92,11 @@ # nano | ||
`doc.insert(doc,doc_name*,callback*)` | ||
`doc.destroy(doc_name,rev,callback*)` | ||
`doc.get(doc_name,params*,callback*)` | ||
`doc.bulk(docs,callback*)` | ||
`doc.list(params*,callback*)` | ||
`doc.attachment.insert(doc_name,att_name,att,content_type,params*,callback*)` | ||
`doc.attachment.get(doc_name,att_name,params*,callback*)` | ||
`doc.attachment.destroy(doc_name,att_name,rev,callback*)` | ||
`db.insert(doc,doc_name*,callback*)` | ||
`db.destroy(doc_name,rev,callback*)` | ||
`db.get(doc_name,params*,callback*)` | ||
`db.bulk(docs,callback*)` | ||
`db.list(params*,callback*)` | ||
`db.view(design_name,view_name,params*,callback*)` | ||
`db.attachment.insert(doc_name,att_name,att,content_type,params*,callback*)` | ||
`db.attachment.get(doc_name,att_name,params*,callback*)` | ||
`db.attachment.destroy(doc_name,att_name,rev,callback*)` | ||
@@ -102,0 +103,0 @@ ### aliases |
@@ -19,23 +19,2 @@ var ensure = require('ensure') | ||
tests.recursive_create_db = function (tried,callback) { | ||
if(typeof tried === 'function') { | ||
callback = tried; | ||
tried = {tried:0, max_retries:5}; | ||
} | ||
nano.db.destroy("db_cr2", function () { | ||
nano.db.create("db_cr2", function () { | ||
if(tried.tried === tried.max_retries) { callback(null,true); } | ||
else { | ||
tried.tried += 1; | ||
tests.recursive_create_db(tried,callback); | ||
} | ||
}); | ||
}); | ||
}; | ||
tests.recursive_create_db_ok = function (_,v) { | ||
nano.db.destroy("db_cr2"); | ||
assert.equal(v,true); | ||
}; | ||
ensure(__filename, tests, module); |
@@ -14,3 +14,2 @@ var ensure = require('ensure') | ||
tests.destroy_db_ok = function (e,b) { | ||
nano.db.destroy("db_de1"); | ||
assert.isNull(e); | ||
@@ -17,0 +16,0 @@ assert.equal(b.ok, true); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
51113
34
1230
184