That is not the only part of the story and probably you know this and you are hiding it to the general audience that doesn't know about Bitcoin internals.
You don't have a global getter on bitcoin transactions to get the hash of every document, so querying all the documents persisted on the Bitcoin blockchain you should build a database outside the Bitcoin blockchain to obtain them.
And don't forget the strict buffer limitations in the OP_RETURN that makes difficult to add more data and require to span the buffer within multiple transactions.