I would like to delete the document which a script is called upon.
The use case for this is I have a list of resources in the doc, which can grow or shrink, according to their availability.
I want the doc to disappear when this list becomes empty, so when I call the script -let's name it removeResource-, it should simply delete the doc when this list becomes empty in the same transaction.
Is this possible to do via scripting? How?
Are there any extended docs in scripting?