Uploaded image for project: 'Mongoid'
  1. Mongoid
  2. MONGOID-4826

Support hashed shard key declarations, add rake task to shard collections

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0
    • Affects Version/s: None
    • Component/s: Dev Exp
    • None

      Mongoid currently provides a way to declare shard keys on model classes, similar to index declarations. However the syntax only supports ranged shard keys, not hashed shard keys, and does not support options that can be passed to shardCollections command.

      Also, there is seemingly no way to actually use these declarations - although Mongoid has rake tasks to create indexes, there are no rake tasks to shard collections.

      Thus the changes proposed in this ticket are:

      Expand shard_key syntax to support hashed shard keys and passing options to shardCollection
      Add a rake task to shard collections, followed declared shard configuration
      Add tests for shard_key and the rake task in question
      Follow guidance in https://jira.mongodb.org/browse/SERVER-17397 to reset metadata cache in mongos

      Contributed PR: https://github.com/mongodb/mongoid/pull/4650

            Assignee:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: