I needed to change the way ObjectIds are read from and written to BSON. BSON is 
a format that encodes its byte contents little endian. In mongo database the 
format of ObjectIds is different. The way an ObjectId is encoded is big endian. 
You can see this if you compare the outputs for an object when read from mongo 
shell and from pharo. The ids won’t match. 

If you do „normal“ stuff with mongo it is unlikely you have noticed the effect. 
An OID is read the wrong way but also written the wrong way which makes it 
right again from the mongo database perspective. But it won’t work if you use a 
mixed query setting. Meaning reading an OID and requesting the database using 
javascript expression. This will fail.

I’m writing this because I’m not sure the change can break existing software. 
The change is not included in the stable version, yet. If you want to test then 
load #bleedingEdge and report any problem that might occur. I will use the new 
behaviour and will take the freedom to make it stable if it works for some time.

FYI,

Norbert


Reply via email to