-
Notifications
You must be signed in to change notification settings - Fork 4
Description
I have a MongoDB collection that have data with user-defined binary subtypes.
bson-haskell only handles the subtype explicitly defined in the spec (0x80 for user-defined data), but it's possible to use any byte value for the subtype in MongoDB.
0x80 is a strange choice of constant to use for user defined, unless the intention was allow values of 0x80 and above to be user defined. And there is definitely a use for multiple user-defined binary types.
The values of the subtype in my collection are all 0x80 and above.
In any case, I would like for bson-haskell to be able to read my data without failing and leave the interpretation of binary data to the application.
To avoid breaking the interface, I changed UserDefined in my local copy to:
data UserDefined = UserDefined S.ByteString | UserDefinedExt Word8 S.ByteString
and all data with unknown subtype becomes UserDefinedExt.