summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--share/server/main.js2
-rw-r--r--share/www/script/couch_tests.js12
2 files changed, 10 insertions, 4 deletions
diff --git a/share/server/main.js b/share/server/main.js
index 9773cf6c..05615ccd 100644
--- a/share/server/main.js
+++ b/share/server/main.js
@@ -74,7 +74,7 @@ while (cmd = eval(readline())) {
// ]
//
var doc = cmd[1];
- seal(doc); // seal to prevent map functions from changing doc
+ seal(doc, true); // seal to prevent map functions from changing doc
var buf = [];
for (var i = 0; i < funs.length; i++) {
map_results = [];
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);