diff options
author | Christopher Lenz <cmlenz@apache.org> | 2008-06-23 15:23:32 +0000 |
---|---|---|
committer | Christopher Lenz <cmlenz@apache.org> | 2008-06-23 15:23:32 +0000 |
commit | 3164ddedffaadf26837c9a0a9bf366048b230b54 (patch) | |
tree | f61d34fcf618f413812169418ca1b85024cc9113 /share/www/script | |
parent | 45c97d183c73e0058265f2de77416a2f215edd93 (diff) |
Seal the document in Javascript view functions in 'deep' mode so that it's not possible to modify values in nested arrays and objects.
git-svn-id: https://svn.apache.org/repos/asf/incubator/couchdb/trunk@670653 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'share/www/script')
-rw-r--r-- | share/www/script/couch_tests.js | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/share/www/script/couch_tests.js b/share/www/script/couch_tests.js index cc770a9b..e09569c2 100644 --- a/share/www/script/couch_tests.js +++ b/share/www/script/couch_tests.js @@ -871,12 +871,18 @@ var tests = { db.createDb(); if (debug) debugger; - var docs = makeDocs(1, 2); - T(db.bulkSave(docs).ok); + var doc = {integer: 1, string: "1", array: [1, 2, 3]}; + T(db.save(doc).ok); // make sure that attempting to change the document throws an error var results = db.query(function(doc) { - doc._id = "foo"; + doc.integer = 2; + emit(null, doc); + }); + T(results.total_rows == 0); + + var results = db.query(function(doc) { + doc.array[0] = 0; emit(null, doc); }); T(results.total_rows == 0); |