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

$toHashedIndexKey expression doesn't add any dependencies

    XMLWordPrintableJSON

Details

    • Fully Compatible
    • ALL
    • v5.0, v4.4, v4.2
    • 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") }
    • Sharding 2021-06-28
    • 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

              kshitij.gupta@mongodb.com Kshitij Gupta
              max.hirschhorn@mongodb.com Max Hirschhorn
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: