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

distinct returns duplicate values

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

      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}}]})
        [ ]

        1. 5974.js
          0.6 kB

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

              Created:
              Updated:
              Resolved: