Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compound sharding key #158

Open
ghost opened this issue Oct 29, 2013 · 1 comment
Open

Compound sharding key #158

ghost opened this issue Oct 29, 2013 · 1 comment

Comments

@ghost
Copy link

ghost commented Oct 29, 2013

Hi,

We are trying to deploy a complete sharded environment using a compound shard key. We have modified the libraries/mongodb.rb to allow this:

sharded_collections.each do |name, key|
      cmd = BSON::OrderedHash.new
      cmd['shardcollection'] = name
      cmd['key'] = key # before {key => 1} 
      begin

and the sharding key is defined in role like this:

     "sharded_collections": {
        "db.col":{       
          "field1": 1,
          "field2": 1
        }
      }

so far we have only managed to get this error,

Error executing action `create` on resource 'ruby_block[config_sharding]'

trying to execute the line 311:

result = admin.command(cmd, :check_response => false)

any clue what are we doing wrong?

thanks

@josephholsten
Copy link

honestly I've got no idea, except that your command is shardcollection instead of shardCollection, and I see the docs are here: http://docs.mongodb.org/manual/reference/command/shardCollection/

I'm happy to get support for compound keys added, anything I can do to help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant