No more orphaned document_data objects

When a document’s data is replaced, the old version should be deleted if
the document was its last remaining reference.