P
P
PAJCH2015-12-07 15:38:52
MongoDB
PAJCH, 2015-12-07 15:38:52

What is the best way to implement the following structure in mongodb?

Hello, please answer the best way to implement the following structure.
There is a large service in which about 1k people register per day. Users have the ability to write messages, add their entries to the feed. The total number of messages of all users per day is about 10 million and about 800.000k tape entries.
These records and messages need to be stored in a database (in our case, mongodb). There is a concept of sharding and replication. Let's say I implemented sharding with 2.3 database servers. But how do I implement a message record and tape record structure that is less overhead and faster for the database server to respond?
Could such an example method help?
Every day in the database of this or that server, a database is created (meaning a database is created in which there are collections) and for each user a collection for messages, a collection for the tape is created.
Example:
1k people signed up per day.
There is already a database created today (for example: db1449491310772).
For each user, I have 2 collections (for messages, for feed entries).
That is, in the database db1449491310772 I now have 6k collections.
Thus, if 1k people wrote 10 million messages a day, then 1 person wrote 10k messages on average, so I won’t have to look through 10 million messages and search for the messages of this user from these messages, and I won’t have to scroll through 10 million objects (messages) , but only 10k.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question