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

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

    • Type: Icon: Improvement Improvement
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.0.14
    • Component/s: Querying
    • Query 2020-03-23

      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.

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

              Created:
              Updated:
              Resolved: