Shamoon
Shamoon

Reputation: 43579

Schema setup for a relationship counting system (MongoDB)

I am trying to see how frequently items (in a shopping cart) appear together. So if a customer buys item1 and item2, it has a count of 1. If another customer buys item1, item2, and item3 then the item1-item2 count should become 2 and the item1-item2-item3 count should become 1.

I understand it will become VERY large, but that's okay. Once the data is built up, there won't be many writes, but there will be a TON of reads. I'm using node.js with mongoose, if that matters.

Upvotes: 0

Views: 90

Answers (1)

3rf
3rf

Reputation: 1164

In your example of 150 items in a set, the number of combinations you would have to store a counter for would be 1427247692705959881058285969449495136382746473. You might want to stick to just storing pairs if you want to make this general-purpose :)

Upvotes: 1

Related Questions