Open jeroenvandijk opened 13 years ago
The unchanged validation function doesn't seem to allow deletion of docs. I think it should be the following instead (note the _delete check):
function (newDoc, oldDoc, userCtx) { function unchanged(field) { if (oldDoc && !newDoc._deleted && toJSON(oldDoc[field]) != toJSON(newDoc[field])) throw({forbidden : "Field can't be changed: " + field}); } unchanged("created_at"); }
This will not allow changes to the created_at field, but does allow deletion.
You should also check the very important author field otherwise the whole point of limit only the author to be able to change the document has gone.
The unchanged validation function doesn't seem to allow deletion of docs. I think it should be the following instead (note the _delete check):
This will not allow changes to the created_at field, but does allow deletion.