A document is:
Documents on the web (saved in a body request) have generally by nature a hierarchical nature (as opposed to tabular)
This is generally a HTML document but it can be also other type of document such as:
This document (file) can be rendered by the user agent (Generally a browser)
The term document in a file system is generally a file including its structure and format, e.g. fonts, colors, and images.
Database can store document in a field or as a row and offers function for document processing. See Database - Document Database
In natural language processing / full text search, a document is composed of word (term) known also as bag of word. See Natural Language - Document