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

distinct returns duplicate values

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.0.2
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Environment:
      FreeBSD 8.2, 64-bit
    • Operating System:
      ALL

      Description

      Here is dump of mongo shell.

      1. some documents have "jclient.targets_list" == []
        > db.mondata.find({"jclient.targets_list": {$exists: true}}).count()
        578244
      2. some documents have no "jclient" at all
        > db.mondata.find({"jclient.targets_list": {$exists: false}}).count()
        3943
      3. it's indexed field
        > db.mondata.getIndexKeys()
        [
        [skipped] { "jclient.targets_list" : 1 }

        ]

      4. and.... here is "distinct"
        > db.mondata.distinct("jclient.targets_list")
        [ null, null ]

      It really looks like bug.

      Here are some more strange samples:
      > db.mondata.distinct("jclient.targets_list", {"jclient.targets_list": {$exists: true}})
      [ ]
      > db.mondata.distinct("jclient.targets_list", {"jclient.targets_list": {$exists: false}})
      [ null ]

      1. so [] + [null] should be [null], should not it?
        > db.mondata.distinct("jclient.targets_list", {$or: [{"jclient.targets_list": {$exists: false}}, {"jclient.targets_list": {$exists: true}}]})
        [ ]

        Attachments

        1. 5974.js
          0.6 kB

          Issue Links

            Activity

              People

              Assignee:
              siddharth.singh@10gen.com siddharth.singh@10gen.com
              Reporter:
              darkk Leonid Evdokimov
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: