Closed aijnn closed 8 months ago
Is this particular round-trip inequality causing a specific issue?
In general, we prefer to err on the side of accepting input where possible and producing spec-conforming output; this kind of situation is a side effect of that.
There has not been any recent activity on this ticket, so we are marking it as stale. If we do not hear anything further from you, this issue will be automatically closed in one week.
There has not been any recent activity on this ticket, so we are closing it. Thanks for reaching out and please feel free to file a new issue if you have further questions.
Versions/Environment
Describe the bug
Serialising and then deserialising a BSON document produces a different document if the document contains
Regex
with unsortedoptions
:This can be demonstrated with the below example
examples/regex.rs
:Which produces the following output:
Expected behavior
Serialising and then deserialising always produces identical document.
Actual behavior
Serialising and then deserialising a document containing
Regex
with unsortedoptions
produces a different document.Why this may be happening
Serialisation sorts
Regex
options
. Note that deserialisation does not seem to sortoptions
.To reproduce
{"": Regex { pattern: "", options: "ba" }}
0x0b0000000b000061620000
{"": Regex { pattern: "", options: "ab" }}
Suggested fix
Either:
Regex
with unsortedoptions
, since such a document is not valid according to the specificationRegex
with unsortedoptions
as is, without any sorting