Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-89056

refineCollectionShardKey does not translate metaField

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Execution
    • ALL

      The underlying system.buckets.collections always has a metaField value of "meta". When operations are performed on the time-series view, the metaField name of the view (which could be anything) should be translated to "meta" so that the command could then be performed on the underlying buckets collection internally.

      It appears that we do not do this for refineCollectionShardKey. So, if we created a time-series collection with metaField: "metadata", we can successfully shard it on, for example, 

      {"metadata.subField1" : hashed}

      but if we try to refine the shard key to be, for example: 

      {"metadata.subField1" : "hashed", "metadata.subField2": 1}

      we get the following error:

      refineCollectionShardKey shard key { metadata.subField1: "hashed", metadata.subField2: 1 } does not extend the current shard key { meta.subField1: "hashed"  

      If the view's metaField was "meta", this command would work fine, which is why I believe we haven't caught this issue before.

      We should make sure that the metaField name is translated so that users can run refineCollectionShardKey on their view without worrying about the underlying metaField name.

            Assignee:
            Unassigned Unassigned
            Reporter:
            damian.wasilewicz@mongodb.com Damian Wasilewicz
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: