Hey @Srdjan_Cengic,
Welcome to the MongoDB Community Forums! ![]()
Your initial approach of embedding columns and cells within a single collection of “tables” is a reasonable one, given that columns and cells are tightly coupled to the table and have no meaning outside of it. However, as you pointed out correctly, this approach could lead to performance issues as the number of cells and columns grows. Also, MongoDB has a limit of 16MB on the BSON document size.
Yes, you can have different ids in each embedded document for referencing easily.
Additionally, I would like to point out one thing about data modeling in MongoDB. A general thumb rule to follow while schema designing in MongoDB is things that are queried together should stay together. Thus, it may be beneficial to work from the required queries first and let the schema design follow the query pattern.
Ultimately, the best approach depends on your specific use case and performance requirements. You may want to consider testing out different approaches and measuring their performance to determine which one works best for your needs. You can use mgeneratejs to create sample documents quickly in any number, so the design can be tested easily.
Additionally, since you’re new to MongoDB, I’m linking some more useful resources that you can explore:
Data Modelling Course
MongoDB Indexing
Please let us know if you have any additional questions. Feel free to reach out for anything else as well.
Regards,
Satyam