You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We're actually trying to read a file from a GridFsBucket in Java which was created in Rust.
Java claims that it cannot cast a Long value into an Integer.
Im not sure why this happens but in my case on the Upload side in Rust the "chunkSize" in "fs.files" and "n" in "fs.chunks" has the type int64.
It seems like the driver is implemented with a u32 ?!
Clearly Java driver is wrong here, because having negative number of chunks or chunk size makes absolutely no sense. Before Java 8, there was absolutely no way of using unsigned numbers in Java. Currently you can use Integer wrapper class for this. I guess mongodb java driver needs some modification for this to work.
This is indeed a bug in the Rust driver - because bson has no representation for unsigned numbers, the Rust bson crate stores them as the next-wider signed integer type. In this case, it meant that the fields in question were being stored as int64, and the specification requires them to be int32. #941 will fix this, and will be in our next release (this week).
kevinAlbs
changed the title
Question: GridFS is the rust driver compatible with the java driver?
RUST-1743 Question: GridFS is the rust driver compatible with the java driver?
Aug 29, 2023
Versions/Environment
Describe the bug
We're actually trying to read a file from a GridFsBucket in Java which was created in Rust.
Java claims that it cannot cast a Long value into an Integer.
Im not sure why this happens but in my case on the Upload side in Rust the "chunkSize" in "fs.files" and "n" in "fs.chunks" has the type int64.
It seems like the driver is implemented with a u32 ?!
https://github.com/mongodb/mongo-rust-driver/blob/v2.6.1/src/gridfs.rs#L55
https://github.com/mongodb/mongo-rust-driver/blob/v2.6.1/src/gridfs.rs#L34
Currently we use the Java driver version:
A File upload on the java side stores chunkSize and n as i32.
To Reproduce
Steps to reproduce the behavior:
For now the following Code fixes my Problem but it would be nice to remove this Workaround:
The text was updated successfully, but these errors were encountered: