Implement feature #64

Example of script:
if(ctx.document._parentId) { ctx._parent = ctx.document._parentId;
delete ctx.document._parentId;}
Refactor unit test