Requirements engineering in schema

Hello, I had a lot of questions about the design of a certain type of system before and I thought about it for almost a year, but today is the time of implementation and I had to ask a question here for the first time.

My design is multi-tenant, so as a rule, the data of all users, for example, the collection of products, should be in one place. Well, I have to give the user the possibility to, for example, return the data to yesterday’s time if he wants. My system has a lot of users and the volume of data is high, and I can’t do many deletion requests and I have to write, for example, delete a certain collection or document and replace it from the backup.

I don’t see 2 more approaches.
One is that I create a unique group for each user for the group of products, which is an anti-design pattern, and I may have, for example, 20 million users, and on the other hand, the models are not added on new sharded nodes, but on all nodes. are applied.
It should be considered that these are only products and I have to do this, for example, for the collection of comments, etc., even though my system is a microservice and my databases are separate, but I think this approach is terrible.

Another approach is to come and put all the data of a user in one document and increase the size of documents to more than 16 megabytes, which creates 100 more challenges.

Well, do you have any other suggestions, should I look outside the box?

Another case is that a set of mine has 10 indexes.
Well, the number of my users is high, and on the other hand, the volume of documents and document production is also extremely high for the type of business.
I have a lot of questions here
1- Here, the database must first distinguish the user’s documents from the other user’s and then apply a filter, in my opinion, this method is problematic in high volumes.
2- Isn’t it better to make an algorithm to find the desired document myself and not use indexes to reduce the terrible amount of indexes in RAM and increase the speed?
3- What algorithm do you use to make the product price 20, size 40, color blue, etc. in Mango DB? I mean, what algorithm does MongoDB use for multiple profiles?
Should I use another database?

Hi Reza Salehi,

I couldn’t fully understand the needs of your application, but from what I could get, the Building with Patterns series would help you with your data modeling.

1 Like

Hi again,
I want to correct and summarize my question, I need to allow my users to go back to any previous backup in a multi-talent database.
What approaches do I have ahead? What do you suggest?
The only solution I see is to isolate the data at the table level, per user a table or collection!