I may be writing an Eiffel BSON library, and I hope I will be allowed to make it generally available (and likewise a pure Eiffel driver for MongoDB). After discussing with Jocelyn an Javier, we agreed that this is best as a new library, and not as an extension to Eiffel_json.
The BSON specification requires serializing in little-endian format, and furthermore, the MongoDb wire protocol requires that this happens ober a TCP socket.
So I thought I had a stumbling block, in as much as SOCKET always writes big-endian. Internally, it uses a MANAGED_POINTER, which DOES have all the necessary routines. But it does not export this. Jocelyn thinks the best answer to this problem is to add put_real_64_le etc. to class SOCKET. This seems like it ought to happen.
However it would be better if the library were written to be able to serialize to any IO_MEDIUM (and so could be used for applications other than MongoDB if desired). It seems to me that as IO_MEDIUM exposes put_managed_pointer, I can do this, using the same pattern that SOCKET does.
That's fine for serializing, but we also need to read BSON documents coming over the medium. Read_to_managed_pointer will do that, so I think this is do-able. Still, it seems strange that IO_MEDIUM does not support reading and writing objects in a known endianess directly.