Converts a document to an array of documents representing key-value pairs.