How to delete a blob

Here’s a code snippet to add a blob in Android:

// Add a blob
ByteArrayInputStream inputStream = new ByteArrayInputStream(new byte[] {0, 0, 0, 0});
Blob blob = new Blob("application/octet-stream", inputStream);
// Add the blob to the Document
mutableDocument.setBlob("myblob", blob);
try {
    // Save the document
    database.save(mutableDocument);
} catch (CouchbaseLiteException e) {
    Log.e("couchbaseevents", "Error creating database", e);
}

What’s the code to delete a blob later on please? I didn’t find it here: https://docs.couchbase.com/mobile/2.5.0/couchbase-lite-java/

Thanks!

Don’t think of blobs as special types, think of them as any other type and ask yourself “how would I delete an integer?” The answer is, just set the property to something else (like null). If you are concerned about leaving the actual file on the disk, that gets cleaned up during compaction calls (Database.compact()).

I ended up removing the key rather than setting it to null. Setting the field to null will keep the field around with value null.

// example code
mutableDocument.remove(attachmentName);