-
Notifications
You must be signed in to change notification settings - Fork 180
chaging replace document serialization #883
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The Insert uses `human_readable = false` to serialize documents, but the Replace uses `bson::to_document` that uses `human_readable = true`.
Hi @maiconpavi, thanks the PR! I've run a patch and it looks like our tests pass with these changes, but I was curious what your motivation is behind the changes you made. Does the internal representation of the replace command have any significance in your use of the driver? |
The default value of human_readable is true, with that change you can make a wrapper type around |
Hey @isabelatkinson I work with @maiconpavi this change is mainly about improving the consistency of the API, thus making sure this doesn't surprise anyone, and making our code that uses it like Maicon described clearer and simpler. Regards Matheus Xavier |
Hi @neonimp and @maiconpavi, sorry for the delay in response! Thank you for detailing your use case. I'm concerned that making this change will inadvertently change the serialization format produced for other users who are relying upon the
which would lead to different data being inserted into the database and could possibly cause deserialization errors. For this reason we'll need to consider this change as breaking and defer it to a major release. I'll file a ticket for this work to consider it if/when we do a major version release in the future if that sounds alright to you! |
Now if you uses the Regards, |
I agree that the inconsistency between the two methods isn't ideal, but it would still be a breaking change to begin to serialize to a different data format in One thing we could possibly do is add serialization options to the |
Hi @maiconpavi, I'm going to close this out for now but I filed RUST-1687 to track the option I proposed above. Feel free to follow along/comment there if that functionality would be helpful for you! |
The Insert uses
human_readable = false
option to serialize documents, but the Replace usesbson::to_document
that useshuman_readable = true
.This PR aims to make this consistent across both operations.
Regards,
Maicon