Let’s say I have an app that allows users to create ingredients.
I want each user to have 200 ingredients already in the system ready for them to use and edit upon joining the app. Now because I want to allow them the posibility to edit their ingredients, I believe I need to add the 200 ingredients to the database with the createdBy field set to their user id upon account creation. This way a user will only see and edit their own set of ingredients and not someone else’s.
My question is in regards to performance…
If I have 10 users join, the ingredients collection now has 1000 documents. If in 6 months time I have 5000 users. The ingredients collection now has 5 million documents (plus the ingredients users create on their own). 5000 users would be great, but what if there’s even more.
Correct me if I am wrong but I am pretty sure that this would degrade performance as time goes by wouldn’t it? If the query is searching through millions of documents, a user would most likely be waiting quite some time before their ingredients are displayed on the page right?
Is there any other way I can achieve what I want without this potential problem?