I don't know why this happens, but i deleted the last item of a collection using the couchdb web interface.
Strangely the browser seems to skip the removeChild command in the following block:
} else if (collection.length && indexes[change.id]) { //DELETE
removeChild(change.id);
updateIndexes(indexes[change.id]);
}
Happened on Firefox 38.0 on CentOS.
Replacing the condition with collection.length && (indexes[change.id] != undefined) fixes the issue.