From c41c2168f0bf0c561448962dd7573b272ce3e447 Mon Sep 17 00:00:00 2001 From: John Christopher Anderson Date: Sat, 23 May 2009 01:14:13 +0000 Subject: added an design doc option so that doc._local_seq can be available in the map view. Closes COUCHDB-346 git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@777757 13f79535-47bb-0310-9956-ffa450edef68 --- share/www/script/test/basics.js | 6 ++++++ share/www/script/test/design_options.js | 16 ++++++++++++++-- 2 files changed, 20 insertions(+), 2 deletions(-) (limited to 'share') diff --git a/share/www/script/test/basics.js b/share/www/script/test/basics.js index 00785dc8..39500629 100644 --- a/share/www/script/test/basics.js +++ b/share/www/script/test/basics.js @@ -63,6 +63,12 @@ couchTests.basics = function(debug) { var doc = db.open(id, {revs_info:true}); T(doc._revs_info[0].status == "available"); + // make sure you can do a seq=true option + var doc = db.open(id, {local_seq:true}); + console.log(doc._local_seq) + T(doc._local_seq == 1); + + // Create some more documents. // Notice the use of the ok member on the return result. T(db.save({_id:"1",a:2,b:4}).ok); diff --git a/share/www/script/test/design_options.js b/share/www/script/test/design_options.js index c2764b91..7bd7901a 100644 --- a/share/www/script/test/design_options.js +++ b/share/www/script/test/design_options.js @@ -18,16 +18,19 @@ couchTests.design_options = function(debug) { //// test the includes_design option var map = "function (doc) {emit(null, doc._id);}"; + var withseq = "function(doc) {emit(doc._local_seq, null)}" // we need a design doc even to test temp views with it var designDoc = { _id:"_design/fu", language: "javascript", options: { - include_design: true + include_design: true, + local_seq: true }, views: { - data: {"map": map} + data: {"map": map}, + with_seq : {"map" : withseq} } }; T(db.save(designDoc).ok); @@ -60,4 +63,13 @@ couchTests.design_options = function(debug) { T(db.save(designDoc).ok); rows = db.view("bango/data").rows; T(rows.length == 0); + + // should also have local_seq in the view + var resp = db.save({}); + rows = db.view("fu/with_seq").rows; + T(rows[0].key == 1) + T(rows[1].key == 2) + var doc = db.open(resp.id); + db.deleteDoc(doc); + console.log(resp) }; -- cgit v1.2.3