Change stream `documentKey` misreports shard key for dotted fields.

    • Type: Bug
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: 8.0.12
    • Component/s: None
    • None
    • Query Execution
    • ALL
    • Hide

      See above.

      Show
      See above.
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Given a shard key {"a.b": 1} on a collection split at {"a.b": 100}, across 2 shards.

      This works:

      insertMany([{_id: 1, a: {b: 50}}, {_id: 1, a: {b: 150}}])

      ... but this fails due to a duplicate key error:

       insertMany([{_id: 1, "a.b": 50}, {_id: 1, "a.b": 150}])

      This is all fine: it means that the routing doesn't recognize the literal a.b field; it only checks the embedded document.

      If, however, you open a change stream and insert this document:

      { "a.b": 50, a: {b: 150}}

      ... the documentKey in the insert event will include "a.b": 50.

      Thus, the change stream is saying that the shard key indexes on the literal a.b field, which is incorrect.

      Seen in 8.0.12; this may be a longstanding issue, though.

            Assignee:
            Unassigned
            Reporter:
            Felipe Gasper
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: