Skip to content
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

RUST-1743 Fix gridfs numeric type serialization #941

Merged
merged 2 commits into from
Aug 29, 2023

Conversation

abr-egn
Copy link
Contributor

@abr-egn abr-egn commented Aug 28, 2023

RUST-1743

This fixes the Chunk.n and FilesCollectionDocument.chunk_size_bytes to serialize as i32 rather than i64. Happily, deserialization will accept either, so this is backwards-compatible.

Copy link
Contributor

@isabelatkinson isabelatkinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, just one small suggestion!

src/gridfs.rs Outdated
@@ -51,7 +59,7 @@ pub struct FilesCollectionDocument {
pub length: u64,

/// The size of the file's chunks in bytes.
#[serde(rename = "chunkSize")]
#[serde(rename = "chunkSize", serialize_with = "u32_as_i32")]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you should be able to use this method from bson::serde_helpers here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Entirely forgot we had those, fixed :)

@abr-egn abr-egn requested a review from isabelatkinson August 29, 2023 17:42
Copy link
Contributor

@isabelatkinson isabelatkinson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, thanks for the quick fix!

@abr-egn abr-egn closed this Aug 29, 2023
@abr-egn abr-egn reopened this Aug 29, 2023
@abr-egn abr-egn merged commit 044401b into mongodb:main Aug 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants