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

Can't perform queries on sub-documents stored in a field name = the value of that document's index within an array in version 2.4

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • 2.4.9
    • 2.5.4
    • Querying
    • Minor Change
    • ALL
    • Hide

      2.4.9-pre-

      > db.c.insert({a:[{"0":{b:"Hello"}}]})
      > db.c.find({"a.0.b":"Hello"})
      >

      Compare that to 2.5.5-pre-:

      > db.c.insert({a:[{"0":{b:"Hello"}}]})
      Insert WriteResult({ "ok" : 1, "n" : 1 })
      > db.c.find({"a.0.b":"Hello"})
      { "_id" : ObjectId("52a10cd0dd47ad0373e22ae6"), "a" : [ { "0" : { "b" : "Hello" } } ] }
      >

      Show
      2.4.9-pre- > db.c.insert({a:[{"0":{b:"Hello"}}]}) > db.c.find({"a.0.b":"Hello"}) > Compare that to 2.5.5-pre-: > db.c.insert({a:[{"0":{b:"Hello"}}]}) Insert WriteResult({ "ok" : 1, "n" : 1 }) > db.c.find({"a.0.b":"Hello"}) { "_id" : ObjectId("52a10cd0dd47ad0373e22ae6"), "a" : [ { "0" : { "b" : "Hello" } } ] } >

    Description

      Versions 2.4 and 2.5 of MongoDB return different results when performing a query on a sub-document stored in a field that has a numeric name that happens to be the value of the index at which that document is stored within an array field.

      Attachments

        Activity

          People

            benety.goh@mongodb.com Benety Goh
            luke.lovett Luke Lovett
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: