-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: BSON
Description
Cross compatibility between BSON versions is desirable as there can be cases where one has a version installed as a direct dependency of the library along with the driver that has its own different version. Maintaining this compat means keeping the serializer implemented in a way that doesn't access a BSON type object differently than it has in the past (inspect the same properties etc.), as well as keeping the types the same shape and typed the same as they were in previous versions. This can make it quite difficult to change or update components of the BSON library while ensuring we keep types + serializer working in both legacy and modern versions of the library.
Related Work
On-demand BSON Access proposes a deserializer that returns a descriptive format of a BSON object. While it hasn't been finalized it is something along the lines of an ordered list of some struct containing element type, element name, element value. We should consider reworking the serializer to operate on a more abstract structure like that and make the BSON type classes offer a way to transform themselves into that simplified struct. Then the specifics of, say, an ObjectId's implementation is not important to the serializer, only that it provides a way to obtain what BSON format it should become (type 0x07, name and 12 byte sequence).
AC
- File a Writing ticket and EPIC
- TBD
- is related to
-
NODE-4952 EJSON does not validate the _bsontype field the same way that BSON does
- Backlog
-
NODE-5144 Add static BSONValue.isX cross vm context instance of check methods
- Backlog
-
NODE-5910 Remove isUint8Array check from ObjectId serialization and remove set calls for common primary key cases
- Closed
- related to
-
NODE-4843 Demonstrate v4 types working in v5 serializer and v5 types working in v4 serializer
- Closed