Reputation: 4338
How are compound shard key used to generate new chunks? I mean, if I have a shard key like
{key1 : 1, key2 : 1}
and the collection is being populated as we go, how does MongoDB create the new chunks boundaries given that there are two keys? I can see them in the config server BUT I can not read them. they look like
[min key1,min key2] ---> [max key1, max key2]
and many often, min key 2> max key 2. How does that make sense?
In other words, how are the chunks min and max being set on new chunks given the shard key is compound?
key 1 is of type string and key 2 is of type int
I would appreciate it if you could explain it by an example.
Upvotes: 2
Views: 550
Reputation: 7590
The boundary is always from positive to negative infinity. As you insert it will break that initial chunk into smaller ones.
Here is a thread which should answer your question.
Upvotes: 1