(ve)tr@enter:~/Documents/tickets/CS-14146$ mongo
MongoDB shell version: 2.6.3
connecting to: test
mongos> db.getSisterDB('config').settings.update({}, {$set: {value: 1}})
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
mongos> for (var i = 0; i < 20000; i++) {
... db.coll.insert({field: i})
... }
WriteResult({ "nInserted" : 1 })
mongos> sh.enableSharding('test')
{ "ok" : 1 }
mongos> sh.shardCollection('test.coll', {_id: 1})
{ "collectionsharded" : "test.coll", "ok" : 1 }
mongos> sh.status()
--- Sharding Status ---
sharding version: {
"_id" : 1,
"version" : 4,
"minCompatibleVersion" : 4,
"currentVersion" : 5,
"clusterId" : ObjectId("53e153e61a06f4155f0e2439")
}
shards:
{ "_id" : "shard0000", "host" : "enter.local:27018" }
{ "_id" : "shard0001", "host" : "enter.local:27019" }
databases:
{ "_id" : "admin", "partitioned" : false, "primary" : "config" }
{ "_id" : "test", "partitioned" : true, "primary" : "shard0000" }
test.coll
shard key: { "_id" : 1 }
chunks:
shard0000 2
shard0001 1
{ "_id" : { "$minKey" : 1 } } -->> { "_id" : ObjectId("53e154266632858cc22a2205") } on : shard0000 Timestamp(2, 1)
{ "_id" : ObjectId("53e154266632858cc22a2205") } -->> { "_id" : ObjectId("53e154436632858cc22a530d") } on : shard0000 Timestamp(1, 3)
{ "_id" : ObjectId("53e154436632858cc22a530d") } -->> { "_id" : { "$maxKey" : 1 } } on : shard0001 Timestamp(2, 0)