Reputation: 50355
Instead of sharding base on the data, can I shard based on where the request (IP address) coming from?
Hmmm one trick I think of is the data itself contains IP address. Is there another way?
Upvotes: 3
Views: 474
Reputation: 41882
Yes, you'd need to include an IP address field in each document and include it in your shard key. Choosing a good shard key is quite a tricky thing to get right, it depends a lot on the shape of your data and how it'll be queried.
Here's a good place to start: Choosing a Mongo Shard Key
Upvotes: 3