Uploaded image for project: 'Documentation'
  1. Documentation
  2. DOCS-13322

Investigate changes in SERVER-6527: in projection implementation, dotted field inclusion supersedes parent field inclusion

    XMLWordPrintableJSON

Details

    Description

      Description

      Downstream Change Summary

      In 4.2 find projection, it is possible to specify two paths which “collide." For example:
      db.c.find({},

      Unknown macro: {"a.b"}

      ) produces {"a" : { "b" : 1, "c" : 1 }}

      In 4.4, these projections are considered illegal.

      Description of Linked Ticket

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

      Scope of changes

      Impact to Other Docs

      MVP (Work and Date)

      Resources (Scope or Design Docs, Invision, etc.)

      Attachments

        Activity

          People

            jeffrey.allen@mongodb.com Jeffrey Allen
            backlog-server-pm Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              4 years, 6 days ago