Thanks for the answer, but when I try to execute the method document.remove(), I get the following message:
"09061538 Failed to execute script 'workspace://SpacesStore/58b89198-b52b-417c-a311-e9cc1c4f4fc3': Node does not exist: workspace://SpacesStore/60f67e94-6e73-42a2-8f3b-7eefc5e174f0 (statustatus[id=85115changeTxnId=0f6fd51b-248e-4cd8-b3d9-c1bcf4d43649, dbTxnId=13929, deleted=true])"
Besides that, the addon just make things easier when it comes to test the script, anyway, I don't have the possibility of installing an addon such as the JSConsole, so this option is unviable.
I made a simple tests and document.remove() works as expected.
I guess the problem is related with the metadata updating, since the document is removed and after that Alfresco is trying to update that metadata property. May you try triggering removal by using some other method?
Or alternatively, provide the actual script that you are trying to execute, instead of just the single instruction. As well as the whole stacktrace that belongs to the error, not just the message. That way it'd be a lot easier to help pinpoint the cause of it.