Closed Akronae closed 8 months ago
btw, do you need to query / frequently update those fields? maybe you want to use faster/smaller format & store it as bytes inside bson?
@univerz Yes I need to query these documents quite frequently so I need to be able to use mongo filters. For instance, in my application there would be texts where you can click on words. And if you click on for instance "said" the db will be queried for some verb which simple past first person singular declension is equal to "said" and it will return the whole inflection table with all the tenses moods etc.
After some tests, this bug does not happen with the sync
client. And is not related to the insert_one
function itselft but rather the async wrapper (which I have no clues about) because when I comment out the whole function body or if I try to call any other empty function into insert_one
, the same error happens. Any idea why this might happen?
Found out the issue was related to the tokio runtime thread going out of stack memory because of all the Option
enum that are then allocated on the stack. The solution was to box those like so:
// ✅ working now
let error = db.collection::<ManyFields<ManyFields<ManyFields<Box<Option<String>>>>>>("error");
Versions/Environment
cargo pkgid mongodb
&cargo pkgid bson
) https://github.com/rust-lang/crates.io-index#mongodb@2.8.1 https://github.com/rust-lang/crates.io-index#bson@2.9.0db.version()
) 7.2.2Describe the bug
The driver fails to work with big structs and panics with stack overflow error.
To Reproduce main.rs
cargo.toml
For the context, I'm working with Ancient Greek inflection tables, and it can get pretty big (
[present, future, ..., aorist] x [active, indicative, ..., imperative] x [passive, middle, active] x [singular, plural] x ....
). This example is overdone on purpose but keep in mind it's really easy to reach what appears to be a fields limit with real life applications.I'd be happy to help fix this bug (if you guys confirm this is a bug), is there any onboarding I should go through?