Mongo shell injection function for hashing shard key

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Minor - P4
    • 3.7.6
    • Affects Version/s: None
    • Component/s: Shell
    • Fully Compatible
    • Platforms 2018-04-09, Platforms 2018-04-23, Platforms 2018-05-07
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Benjamin Caimano (Inactive)
            Reporter:
            Dmitry Ryabtsev
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

              Created:
              Updated:
              Resolved: