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

Field Matcher: shared stem returns invalid results

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 1.1.3
    • Affects Version/s: 1.0.0, 1.1.0
    • Component/s: Querying
    • None
    • Environment:
      linux x86_64, tested on both versions 1.0.0 and 1.1.0

      The following works as expected (notice the shared stem "foo" is 1 level deep):
      > db["partial_test"].save({foo: {bar: 20}})
      > db["partial_test"].save({foo: {baz: 30}})
      > db["partial_test"].find({},

      {"foo.bar": 1, "foo.baz": 1}

      )
      {"_id" : ObjectId( "4ab26302c030ee7ea3cec844") , "foo" : {"bar" : 20}}
      {"_id" : ObjectId( "4ab26308c030ee7ea3cec845") , "foo" : {"baz" : 30}}

      However. if the shared stem is 2 levels deep ("foo.bar") the returned results are wonky:
      > db["partial_test"].save({foo: {bar:

      {baz1: 20}

      }})
      > db["partial_test"].save({foo: {bar:

      {baz2: 20}

      }})
      > db["partial_test"].find({},

      {"foo.bar.baz1": 1, "foo.bar.baz2": 1}

      )
      {"_id" : ObjectId( "4ab2733fc030ee7ea3cec847") , "foo" : {"bar" :

      {"baz1" : 20}

      , "bar" :

      {"baz1" : 20}

      }}
      {"_id" : ObjectId( "4ab27341c030ee7ea3cec848") , "foo" : {"bar" : {} , "bar" : {}}}

            Assignee:
            mathias@mongodb.com Mathias Stearn
            Reporter:
            minaguib Mina Naguib
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: