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

Distinct: Empty query on hashed index returns bad result

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.6.0-rc0
    • None
    • Querying
    • None
    • Fully Compatible
    • ALL

    Description

      Result from distinct for empty query with a hashed index is incorrect:

      > t.distinct('a', {})
      [ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 ]
      > t.ensureIndex(

      {a: "hashed"}

      );
      > t.distinct('a', {})
      [
      NumberLong("-6504342592125989714"),
      NumberLong("-6200100076853976706"),
      NumberLong("-1529429926180645992"),
      NumberLong("848411777775835583"),
      NumberLong("2433984061343616404"),
      NumberLong("4470791281878691347"),
      NumberLong("4854801880128277513"),
      NumberLong("5902408780260971510"),
      NumberLong("6497670140411665948"),
      NumberLong("9174449368162552349")
      ]
      > t.distinct('a',

      {a: 3}

      )
      [ 3 ]

      Attachments

        Activity

          People

            benety.goh@mongodb.com Benety Goh
            jonathan.abrahams Jonathan Abrahams
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: