-
Type:
Task
-
Resolution: Done
-
Priority:
Blocker - P1
-
None
-
Affects Version/s: None
-
Component/s: None
-
Environment:Windows 7, NodeJS
Hello,
Assuming I have a database: 'boo', with sharding enabled,
And collection: 'uri', with the compound index:
. sharded by key:
{k1:1, k2:1}I want to presplit the collection only using k1. k2 doesn't matter.
Since the system doesn't allow to split by partial shard key, I read here : http://stackoverflow.com/questions/9516206/pre-split-on-a-compound-shard-key,
that you can split in the following way:
db.runCommand( { split : "boo.uri" , middle :
} );
db.runCommand( { split : "boo.uri" , middle :
} );
db.runCommand( { split : "boo.uri" , middle :
} );
This works perfect on the mongo console. but since I'm working with the mongodb client, and I need to send the MaxKey somehow, it fails to work.
Attached the script I used to test the splitting (after having the db and collection indexed and sharded ready)
It includes various tries and the response from mongo.
How can I solve this?
How do I serialize MaxKey properly and get it to work?
Thanks in advance