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

in projection implementation, dotted field inclusion supersedes parent field inclusion

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 4.3.2
    • Affects Version/s: 2.0.6, 2.6.3
    • Component/s: Querying
    • Minor Change
    • ALL
    • Query 2019-11-04, Query 2019-11-18, Query 2019-12-02

      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 }, { } ] }
      

            Assignee:
            ian.boros@mongodb.com Ian Boros
            Reporter:
            aaron Aaron Staple
            Votes:
            1 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: