Created
October 31, 2014 04:30
-
-
Save patrobinson/c82437b33619991de889 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(newDoc, oldDoc, userCtx, secObj) { | |
for (var field in newDoc) { | |
if(/^_/.test(field) == false && typeof newDoc[field] == "string") { | |
if(/^(\{|\[)/.test(newDoc[field])) { | |
throw ({forbidden : field + " field doesn't contain valid JSON:\n" + newDoc[field]}); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment