Skip to content

key i32 to_bson error #150

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

Closed
koshkin-kna opened this issue Mar 22, 2020 · 1 comment
Closed

key i32 to_bson error #150

koshkin-kna opened this issue Mar 22, 2020 · 1 comment

Comments

@koshkin-kna
Copy link

koshkin-kna commented Mar 22, 2020

let mut x: HashMap<i32, i32> = HashMap::new();
x.insert(2, 4);
bson2::to_bson(&x).unwrap();

thread 'main' panicked at 'called Result::unwrap() on an Err value: InvalidMapKeyType(I32(2))'

@saghm
Copy link
Contributor

saghm commented Mar 23, 2020

Hello! BSON only allows strings as keys in documents, so you won't be able to convert a HashMap with integer keys to a Document.

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

No branches or pull requests

3 participants