Refactored: the doctype list API

The doctype list is now generated from a view instead of design documents.