[SERVER-66977] Revise enriched change stream updateDescription format Created: 02/Jun/22  Updated: 29/Oct/23  Resolved: 11/Jun/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.1.0-rc0

Type: Improvement Priority: Major - P3
Reporter: Bernard Gorman Assignee: Bernard Gorman
Resolution: Fixed Votes: 0
Labels: pm1950-m6
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Documented
is documented by DOCS-15406 [Server] Investigate changes in SERVE... Closed
Related
is related to SERVER-63861 Expose rich field information in the ... Closed
Backwards Compatibility: Fully Compatible
Participants:

 Description   

In PM-1950 / SERVER-63861, we exposed additional information about the paths reported by a change stream update operation. This was motivated by the fact that these paths can sometimes be ambiguous; for instance, a dot embedded in a fieldname was indistinguishable from a path separator, and there was no way to tell whether a numeric path component referred to an array index or a field name.

While the syntax we introduced does resolve these ambiguities, we were not entirely satisfied with the end result; we think it will be too cumbersome for users to work with. We therefore propose to rework the format ahead of its release in 6.1.



 Comments   
Comment by Githook User [ 11/Jun/22 ]

Author:

{'name': 'Bernard Gorman', 'email': 'bernard.gorman@gmail.com', 'username': 'gormanb'}

Message: SERVER-66977 Revise enriched change stream updateDescription format
Branch: master
https://github.com/mongodb/mongo/commit/3a08325b923bfd5415881293b60e118ee3f1f170

Comment by Bernard Gorman [ 02/Jun/22 ]

PM-1950 Format

updateDescription: {
    updatedFields: {"obj.sub.obj.d.o.t.t.e.d.a.r.r.a.y...0.0.1.a.b.c": 2},
    removedFields: [],
    truncatedArrays: [{field: "obj.sub.obj.d.o.t.t.e.d.a.r.r.a.y...0", newSize: 1}],
    specialFields: {
        arrayIndices: {
            "obj.sub.obj.d.o.t.t.e.d.a.r.r.a.y..": [0],
            "obj.sub.obj.d.o.t.t.e.d.a.r.r.a.y...0": [0]
        },
        dottedFields: {
            "obj.sub.obj.d.o.t.t.e.d.a.r.r.a.y...0.0.1.a": ["b.c"],
            "obj.sub.obj": ["d.o.t.t.e.d.a.r.r.a.y.."],
            obj: ["sub.obj"]
        }
    }
}

Proposed New Format

updateDescription: {
        updatedFields: {"obj.sub.obj.d.o.t.t.e.d.a.r.r.a.y...0.0.1.a.b.c": 2},
        removedFields: [],
        truncatedArrays: [{field: "obj.sub.obj.d.o.t.t.e.d.a.r.r.a.y...0", newSize: 1}],
        disambiguatedPaths: {
            // Note that the 0 array indexes are captured as ints, the non-array fieldname "1" is a string
            "obj.sub.obj.d.o.t.t.e.d.a.r.r.a.y...0.0.1.a.b.c": ["obj", "sub.obj", "d.o.t.t.e.d.a.r.r.a.y..", 0, 0, "1", "a", "b.c"],
            "obj.sub.obj.d.o.t.t.e.d.a.r.r.a.y...0": ["obj", "sub.obj", "d.o.t.t.e.d.a.r.r.a.y..", 0]
        }
}

Generated at Thu Feb 08 06:06:57 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.