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

distinct returns duplicate values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Duplicate
    • 2.0.2
    • None
    • None
    • None
    • FreeBSD 8.2, 64-bit
    • 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
          siddharth.singh@10gen.com

        Issue Links

          Activity

            People

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

              Dates

                Created:
                Updated:
                Resolved: