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

Document the behavior when projection includes fields "a" and "a.b"

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Duplicate
    • Icon: Major - P3 Major - P3
    • None
    • 4.0.14
    • Querying
    • Query 2020-03-23

    Description

      We found out that when projection includes "a" and "a.b", that is, parent and child document are both in the projection, the order in BSON Document is prominent.  For example:

      These two are equivalent:

      db.document.find({}, {"a.b":1, "a":1})
      db.document.find({}, {"a":1})

      and these two:

      db.document.find({}, {"a":1, "a.b":1})
      db.document.find({}, {"b":1})

      I am wondering whether it is undocumented behavior, or it should be able to include the parent document regardless of the order.

      Attachments

        Activity

          People

            ian.boros@mongodb.com Ian Boros
            mwei Yao Wei
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: