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
- is related to
-
RUBY-2057 Support passing command options to DDL helpers
- Closed
- related to
-
SERVER-17397 Dropping a Database or Collection in a Sharded Cluster may not fully succeed
- Closed
- links to