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

Mongo shell injection function for hashing shard key

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor - P4 Minor - P4
    • 3.7.6
    • None
    • Shell
    • Fully Compatible
    • 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

        Activity

          People

            ben.caimano@mongodb.com Benjamin Caimano (Inactive)
            dmitry.ryabtsev@mongodb.com Dmitry Ryabtsev
            Votes:
            1 Vote for this issue
            Watchers:
            9 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: