gen liu
2011-11-02 02:43:30 UTC
I have a collection with a unique index:{{"folder":1,"name":
1},unique:true},
Then I try to shard the collection:
db.runCommand( { shardcollection : "test.content", key: { _id: 1}} )
it reports error:"can't shard collection with unique index".
I know i can remove the unique index from the collection, and choose
the shard key as unique, like:
db.runCommand( { shardcollection : "test.content", key: { folder: 1,
name: 1}, unique: true} )
But the new shard key ( {folder:1,name:1} ) is not a good key for me.
Any advice?
1},unique:true},
Then I try to shard the collection:
db.runCommand( { shardcollection : "test.content", key: { _id: 1}} )
it reports error:"can't shard collection with unique index".
I know i can remove the unique index from the collection, and choose
the shard key as unique, like:
db.runCommand( { shardcollection : "test.content", key: { folder: 1,
name: 1}, unique: true} )
But the new shard key ( {folder:1,name:1} ) is not a good key for me.
Any advice?