How to delete document in content version?
In the SFDC Objects documentation you referenced, at the top of the page is this line:
create(), describeLayout(), describeSObjects(), query(),
retrieve(), search(), update(), upsert()
No delete - hence a DML delete on this object is not permitted.
This makes sense because in the user interface, you can't delete a version either, only add a new one
All ContentVersion
versions are hung under (as a child) a ContentDocument
. The ContentDocument, if deleted, deletes all child ContentVersions
From the SFDC Object reference documentation on ContentDocument:
When you delete a document, all versions of that document are deleted, including ratings, comments, and tags.