steevej
(Steeve Juneau)
3
To have object equality the fields have to be in the same order with the same value.
I think it is like that for efficiency (and may be predictability) reasons.
The way is it right now is very simple to implement, you go field by field one by one and compare the value. To remove ordering would require to find each field of the rhs in the lhs with the same name before comparing the value. For 2 or 3 fields it would not be too expansive but any techniques would be of the order of 0( n2 ) rather than 0( n ).
Once you know that the best way is to use a well written API that always insert and update documents with the same order of fields.