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

in projection implementation, dotted field inclusion supersedes parent field inclusion

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.0.6, 2.6.3
    • Fix Version/s: 4.3.2
    • Component/s: Querying

      Description

      Observed behavior: In the query projection implementation, the projection

      { a:1, 'a.b':1 }

      is equivalent to

      { 'a.b':1 }

      not

      { a:1 }

      (at least in some cases).
      Expected behavior: The projection

      { a:1, 'a.b':1 }

      is equivalent to

      { a:1 }

      .

      Test:

      > c.save( { a:[ 1, { b:2 }, { c:3 } ] } )
      > c.find( {}, { a:1 } )
      { "_id" : ObjectId("50085e465d040dc2ab6a269a"), "a" : [ 1, { "b" : 2 }, { "c" : 3 } ] }
      > c.find( {}, { 'a.b':1 } )
      { "_id" : ObjectId("50085e465d040dc2ab6a269a"), "a" : [ { "b" : 2 }, { } ] }
      > c.find( {}, { a:1, 'a.b':1 } )
      { "_id" : ObjectId("50085e465d040dc2ab6a269a"), "a" : [ { "b" : 2 }, { } ] }

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                1 Vote for this issue
                Watchers:
                9 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: