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

$toHashedIndexKey expression doesn't add any dependencies

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v5.0, v4.4
    • Steps To Reproduce:
      Hide

      rs:PRIMARY> db.dropDatabase()
      rs:PRIMARY> db.mycoll.insert({b: 2})
      rs:PRIMARY> db.mycoll.aggregate([{$project: {b: {$toHashedIndexKey: "$b"}, _id: 0}}])
      { "b" : NumberLong("2338878944348059895") }
      rs:PRIMARY> db.mycoll.aggregate([{$project: {b: {$toHashedIndexKey: "$b"}, _id: 1}}])
      { "_id" : ObjectId("60d3d020c102ff3ba60884a0"), "b" : NumberLong("848411777775835583") }
      

      Show
      rs:PRIMARY> db.dropDatabase() rs:PRIMARY> db.mycoll.insert({b: 2}) rs:PRIMARY> db.mycoll.aggregate([{$project: {b: {$toHashedIndexKey: "$b"}, _id: 0}}]) { "b" : NumberLong("2338878944348059895") } rs:PRIMARY> db.mycoll.aggregate([{$project: {b: {$toHashedIndexKey: "$b"}, _id: 1}}]) { "_id" : ObjectId("60d3d020c102ff3ba60884a0"), "b" : NumberLong("848411777775835583") }
    • Sprint:
      Sharding 2021-06-28
    • Story Points:
      1

      Description

      ExpressionToHashedIndexKey::_doAddDependencies() doesn't add the dependencies of its _children[0] expression. This causes the $project stage to incorrectly treat the field path expression as a missing value and hash it to the value of an explicit null value.

      void ExpressionToHashedIndexKey::_doAddDependencies(DepsTracker* deps) const {
          // Nothing to do
      }
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              kshitij.gupta Kshitij Gupta
              Reporter:
              max.hirschhorn Max Hirschhorn
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: