title: Sharding by ObjectID, is it the right way?
body: <p>I'm just like many others is thinking about correct approach to shard my collections in Mongo. Main question is - how does auto-sharding work?</p>
  
  <p>The official doc says - "MongoDB scales horizontally via an auto-sharding (partitioning) architecture" and "To partition a collection, we specify a shard key pattern." with note "It is important to choose the right shard key for a collection" :). <br/>
  <a href="http://www.mongodb.org/display/DOCS/Sharding+Introduction#ShardingIntroduction-ShardKeys">http://www.mongodb.org/display/DOCS/Sharding+Introduction#ShardingIntroduction-ShardKeys</a> <br/>
  <a href="http://www.mongodb.org/display/DOCS/Choosing+a+Shard+Key">http://www.mongodb.org/display/DOCS/Choosing+a+Shard+Key</a> <br/></p>
  
  <p>Now the question is - "is this right key"(sharding by ObjectID)?</p>
  
  <pre><code>db.runCommand({ shardcollection : "test", key : { _id : 1 }})
  </code></pre>
  
  <p>What happens internally in Mongo for ? How Mongo will split data to chunks in this case? Assuming i initially have 10mln of records with 2 shard servers - what happens on Mongo side when I'd like to add 2 more shard server when collection reaches 20mln records? I could not find that level of details anywhere on Mongo-related sources.</p>
  
  <p>Taking into account random nature of autogenerated _id and it's structure, <br/></p>
  
  <p>...   <a href="http://www.mongodb.org/display/DOCS/Object+IDs">http://www.mongodb.org/display/DOCS/Object+IDs</a> ... </p>
  
  <p>i would shard by the least significant byte (rtl order) with chunks split by value of 2-3 bytes - this would provide easy way to shard by 2^N of shard servers - 2, 4, 8, .., 256 shard servers with more-or-less even load on each shard and with minimal required configuration. As far as i understand Mongo supports only sharding/chunking by explicitly defined ranges and that my idea will not work. Is is true?</p>