Skip to content

Expand UserDefined to include Subtype as defined in the BSON spec #24

@antarestrader

Description

@antarestrader

Proposal

In the Notes section of the BSON spec the seventh bullet described BinData. The third sub-bullet describes the user-defined type, "\x80-\xFF "User defined" subtypes. The binary data can be anything."

Our implementation limits this to only 0x80 and throws and error on other subtypes.

I propose that the UserDefined type be redefined to include a Word8 subtype field and that accompanying changes be made to the binary get and put functions.

data UserDefined = UserDefined Word8 ByteString

Use Case

The BSON format while more compact than JSON is still a rather verbose document particularly with the way it encodes arrays. I would like to leverage the UserDefined binary part of the spec to store packed vectors of data. Using the subtype field would allow me to identify what was in the packed date without having to use a separate field of tag.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions