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

Mongo shell injection function for hashing shard key

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.7.6
    • Component/s: Shell
    • Labels:
    • Backwards Compatibility:
      Fully Compatible
    • Sprint:
      Platforms 2018-04-09, Platforms 2018-04-23, Platforms 2018-05-07

      Description

      Users may sometimes want to figure out the hashed value for a certain document's shard key field. For instance the reason for doing that might be to identify the shard key range / chunk the document belongs to (when a hashed shard key is used). There a ways to do that, namely:

      • Run a query on the shard key and inspect the index key (the `$returnKey` query option)
      • Run a query on the shard key and inspect the index scan bounds in the $explain output
      • Re-start the server in test mode and use the _hashBSONElement command
      • Port BSONElementHasher into a custom application

      All of these methods are pretty clumsy and inefficient when all you need is to get a hashed value for an arbitrary field. It would be much user-friendly if BSONElementHasher could be run on the client side (i.e. in the mongo shell) via a helper function.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              ben.caimano Benjamin Caimano
              Reporter:
              dmitry.ryabtsev Dmitry Ryabtsev
              Participants:
              Votes:
              1 Vote for this issue
              Watchers:
              9 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: