1 / 1
Jul 2024

Hello!

So I have this aggregate execution in my backend:

let search = vec![ doc!{ "$search": { "index": "default" , "autocomplete": { "query": query , "fuzzy": { "prefixLength": 3 as u32 , "maxExpansions": 3 }, "path": field } } } ];

Which uses an autocorrect indexed collection as expected. However, when running my unit tests, it never reaches “Print success” unless I run in debug and put a break point:

if let Ok(mut r) = collection.aggregate(search).await { let mut results = Vec::<(String, String)>::new(); while let Some(d) = r.next().await { println!("Search success!");

It seems to me there is some data race going on in the aggregate call. Anyone knows why this is?

If I run the very same query on the MongoDB dashboard it works just fine, so the query itself isn’t the problem.

Thanks,
Gustav