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

distinct don't use object's keys inside of arrays ("dot notation" doesn't work)

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.5.0
    • Affects Version/s: 1.1.2, 1.2.3, 1.3.2
    • Component/s: Querying
    • Labels:
      None
    • Environment:
      OSX 10.6.2 x64
    • Major Change

      I'm trying to get distinct values for keys inside of array:

      > use test
      switched to db test
      > db.coll.insert({foo:[

      {bar1: "baz11"}

      ,

      {bar1: "baz22"}

      ]});
      ObjectId("4b853fad1ee5c842365f1d6e")
      > db.coll.find();
      { "_id" : ObjectId("4b853fad1ee5c842365f1d6e"), "foo" : [

      { "bar1" : "baz11" }

      ,

      { "bar1" : "baz22" }

      ] }
      > db.coll.distinct("foo.bar1");
      [ ]

      I get empty result, but I'm waiting for [ "baz11", "baz22" ] because of "dot notation"

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            snick Ilya Remizov
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: