This works:
let documents = vec![
doc! {"name": "Maisey", "breed": "Treeing Walker Coonhound"},
doc! {"name": "Ramsay", "breed": "Native American Indian Dog"},
doc! {"name": "Comet", "breed": "Whippet"},
];
coll.insert_many(documents, None).await?;
This does not. Is there a way to get insert_many
to work with an array instead of a vector?
let documents: [Document; 3] = [
doc! {"name": "Maisey", "breed": "Treeing Walker Coonhound"},
doc! {"name": "Ramsay", "breed": "Native American Indian Dog"},
doc! {"name": "Comet", "breed": "Whippet"},
];
coll.insert_many(&documents, None).await?;
The error is:
type mismatch resolving <&[mongodb::bson::Document; 3] as IntoIterator>::Item == mongodb::bson::Document
I know that the array type does implement IntoIterator
so I thought this would work.