I have done some work to connect to MongoDB using Pike and that requires the use of BSON.
Unfortunately, MongoDB seems to think that BSON is an ordered document, i.e. the order of the indices in the encoded document matters. This is something that Pike doesn't support as we use mappings as input (which does not have a guaranteed order).
I see two ways out of this; either we extend the BSON API in pike to allow for a sorted array to specify the indices in the order they should be added to the BSON document or we fix the multiset implementation so that it becomes more like what mast intended it to be and switch to that. (His intention was to make it more like an ordered mapping)
Out of the two, option 1 is trivial and that is what I did for now. It is ugly as **** though and I'd much prefer option 2 but that seems to be a lot more complicated if you ask me.
In the long run, I guess we should ask ourselves what the purpose of the current multiset implementation is. I can't really see any value in having the current implementation tbh, but I might be missing something.
So, what do people think? Should we create an extended BSON API as a short (or maybe long-term) solution to get ordered BSON documents and what are the opinions on multisets?