Hi Alex
We have set up a docker mongo instance and are planning to move files generated by an application (doc and pdf) to the database
Are you planning to move the files by storing them in the database itself, e.g. by using a blob object (BinData)?
I am personally a fan of the directory breakdown approach so one collection per directory
what is the best methodology to use on bson objects like these?
It’s hard to say without knowing the details of your use case. However, please note that MongoDB requires that no single document can be larger than 16MB (see Limit and Thresholds), so if any document in the future exceeds this limit, you may not be able to store it.
If you need to store more than 16MB of data, you may want to consider GridFS, which is a convention designed to store files larger than 16MB in MongoDB. Officially supported drivers would have support for GridFS natively.
There could be arguments made for a single collection, or multiple collections, and the solution would be highly dependent on your use case. If you feel that the database could be managed more efficiently using multiple collections, then that's probably the right solution for you. Regarding general pointers for schema design, you may find the following links helpful:
Best regards,
Kevin