I'm currently designing a shop system with these entities:
- Account (Millions), username, email, password...
- Product (Millions), title, description, rating...
An account can acquire a license for a product (many-to-many). I will have a page where I display all the Products licensed by a given account.
Current concept: Product has an array of licensed Accounts, so that I can use find(licensed_accounts: ObjectId("4d731fe3cedc351fa7000002"))
.
I am expecting a lot of accounts. For popular products, that array might contain millions of ObjectIds (12byte * 1,000,000 = 12MB). One million will bring the document close to its current 16MB size-limit already.
Is there a better approach to handle this? Or is MongoDB the wrong tool for that many relations?