Custom limitation on data size

Hello all,

I need a database to store temporary data before passing it to the next stage. My company is currently using MongoDB, so I try a capped collection on standalone server to store documents with custom size and number of documents. Everything seem fine.

However, I need to upgrade the system as follow:

1, There will be more collections, I need to control the limit (size and number) of all these collections. Not each one a time, but all collections; For example, I have a database 10 Gb and 2 collections (A, B), I need to control the size such as A + B < 10 Gb and if the data exceed 10 Gb it will delete the oldest data.

2, I want to deploy it to Replica set, Is there anyway to control the data limit (size and number) on Replica set. I look at the Oplog document but do not think it will limit the data size (it only limit the operations)

Please help me. Please correct me if I have some mistakes.

Thank you!!!

Regards,
Minh

Sorry if the paragraphs are hard to read, this is my first post, i will rewrite it below:

1, There will be more collections, I need to control the limit (size and number) of all these collections. Not each one a time, but all collections; For example, I have a database 10 Gb and 2 collections (A, B), I need to control the size such as A + B < 10 Gb and if the data exceed 10 Gb it will delete the oldest data.

2, I want to deploy it to Replica set, Is there anyway to control the data limit (size and number) on Replica set. I look at the Oplog document but do not think it will limit the data size (it only limit the operations)