Asking for perfect model

Hey all
I’m working in software company and I’m new their and my boss ask me if I can build app like Instagram it’s social app so
I want to know how to build my model I did a lot but I’m worry for future maybe the app contains billion user maybe who know
And I read that is not recommended at all to have more than 10,000 collections so I wonder for example
Collection for users info
And collection for stores and
Collection for every user followers / following I know if I have 1 billion user I will have 1 billon collection and maybe more so is this is good or to put alllllllll following and followers in one collection and every document set all information who follow who and when he follow him and like that which one is better sure many collection need a good server so with all users owner of the app will earn money so he can do that
Really need help

Hello @Alhassan_Hussein, welcome to the MongoDB Community forum!

One of the main aspect of developing a data model (or design) is to have clear requirements about the data and the application it serves.

The data mode needs a clear definition of the entities (like users) and the relationship between these entities. The relationships are like one-to-one, one-to-many and many-to-many.

The data model is also influenced by the application functionality. The important queries in the application and the amount of data need to be identified to create your model. This will help in aspects like to embed the data or reference the data from other collection.

The above aspects will influence how you create your document structure (or schema) and store in collections and databases. And, further use features like data replication for high availability. For applications with large amounts of data even consider distribution of data in a sharded cluster.

Reference: Data Model Introduction.


I know how to build a model, I just want to know one something:

is this model better or for example to create for every user a collection with his followers/following
because if I will put all all all all followers for all users in one collection this means I will have really very very big collection maybe will cross billion of billon and this we do not want
is this following model good the app like Instagram in everything maybe the app will have billon users one day who knows so please I need a professional who can reply on me can MongoDB handle billions of collections or better to have little collections but have billon of billon of documents ?



Rooms ( groups, chats ) IDS
Room ( all info posts, messages )

Users Collection:

userID {
notificationID string
mongoDBID string
followersCount int
followingCount int
bio string
isPrivate boolen
stories { }

Rooms Collection: ( groups, chat )

roomID string
adminsCount int
membersCount int
lastUpdateTime time stamp
info: group, chat

Room Collection:

RoomID string

info {
type group, chat
status message, postText, postColored, postPoll, …
ownerOfPostOrMessage [ ]
postInfo {


Followers Collection/ Following Collection:


RoomsAdmins Collection:


and soon on