[DRIVERS-1305] Clarify that dollar-prefixed fields not matching known types are left as-is during parsing Created: 23/Jun/20  Updated: 28/Oct/23  Resolved: 01/Oct/20

Status: Closed
Project: Drivers
Component/s: Extended JSON
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Jeremy Mikola Assignee: Jeremy Mikola
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
Driver Changes: Not Needed

 Description   

During a scope review for the "Mitigate pain of using field names with dots and dollars" server project, questions were raised about how the Extended JSON spec handles the case of parsing dollar-prefixed fields.

The Parsers section of the spec states:

When parsing a JSON object other than the top-level object, the presence of a $-prefixed key indicates the object could be a type wrapper object as described in the Extended JSON Conversion table. In such a case, the parser MUST follow these rules, unless configured to allow Legacy Extended JSON, in which case it SHOULD follow these rules

It goes on to say that dollar-prefixed fields matching a known type shall be strictly validated against the structure defined in the spec; however, the spec does not address how dollar-prefixed fields not matching a known type code should be handled.

In the interest of the server project, such fields should be left as-is. This is a first step to ensuring compatibility with the project, and can be addressed before a future ticket to introduce some syntax for escaping dots/dollars in extended JSON (which will ultimately allow conflicts with types like $numberLong to be avoided entirely).



 Comments   
Comment by Jeremy Mikola [ 01/Oct/20 ]

Note: While documenting this in the Extended JSON spec and looking into whether we needed a test case, I came across "Document with keys that start with $" in top.json, which dates back to SPEC-849.

As such, I believe this ticket is simply a clarification (warranting a patch bump rather than minor version bump) and will require no behavior changes to drivers.

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