Skip to content

Commit 044401b

Browse files
authored
RUST-1743 Fix gridfs numeric type serialization (#941)
1 parent d1c12e1 commit 044401b

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/gridfs.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ pub(crate) struct Chunk<'a> {
3131
#[serde(rename = "_id")]
3232
id: ObjectId,
3333
files_id: Bson,
34+
#[serde(serialize_with = "bson::serde_helpers::serialize_u32_as_i32")]
3435
n: u32,
3536
#[serde(borrow)]
3637
data: RawBinaryRef<'a>,
@@ -51,7 +52,10 @@ pub struct FilesCollectionDocument {
5152
pub length: u64,
5253

5354
/// The size of the file's chunks in bytes.
54-
#[serde(rename = "chunkSize")]
55+
#[serde(
56+
rename = "chunkSize",
57+
serialize_with = "bson::serde_helpers::serialize_u32_as_i32"
58+
)]
5559
pub chunk_size_bytes: u32,
5660

5761
/// The time at which the file was uploaded.

0 commit comments

Comments
 (0)