How does Bonita Manage Documents

Hi,
I am trying to understand the DMS part of Bonita Solution. How are documents managed in BonitaSoft.

All interaction happens over API.
If we create a Document inside groovy script, Does the file exist or it needs to be associated with a Document Variable.
Document variable will expose the document with API.
How are Mutiple documents managed ?

As I Understand that , each document is associated with a case id. Hence it is a global search criteria. 

Also we can pair other search criteria like filename and case id and Active case document or Archived case document together. 

Could someone explain how Meta Data is associated with each document ? Do these Meta Data exist in a table.
Do these files exist physically in a blog storage inside a Database in schema DB ? or is the file lying inside a server path ?
How does bonita fetch the physical file.
When the number of files exceed 10K or 50K , will it impact performance. Physically storing inside a Database causes the DB size to increase ?

Any detailed article that talks about the solution aproach and architecture of the System ?