Simplify get type from the hash.

simple changes in `get_type_from_document`