sous-chefs / sc-mongodb

Development repository for the sc-mongodb cookbook
https://supermarket.chef.io/cookbooks/sc-mongodb
Apache License 2.0
75 stars 92 forks source link

support compound sharding keys #142

Open shortdudey123 opened 7 years ago

shortdudey123 commented 7 years ago

Copied from https://github.com/edelight/chef-mongodb/issues/158

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)
github-actions[bot] commented 3 years ago

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.