I have been recently working on Rust with Mongodb to serialize/deserialize structures with a Mongodb collection. I found an article on the internet describing exactly what I am looking for. Unfortunately when I put together some code to test the feature the client.collection_with_type is missing on my system. Perhaps the described functionality no longer exists or has morphed into something else.
I have made sure all my dependencies are using the latest versions of mongo and bson. If there is something I haven't included in my system I would appreciate some direction in finding what I need to add.
I have been recently working on Rust with Mongodb to serialize/deserialize structures with a Mongodb collection. I found an article https://dev.to/techbelle/structuring-data-with-serde-in-rust-for-mongodb-3b31 on the internet describing exactly what I am looking for. Unfortunately when I put together some code to test the feature the client.collection_with_type is missing on my system. Perhaps the described functionality no longer exists or has morphed into something else.
I have made sure all my dependencies are using the latest versions of mongo and bson. If there is something I haven't included in my system I would appreciate some direction in finding what I need to add.
Share Improve this question edited yesterday bhaber asked yesterday bhaberbhaber 12 bronze badges 1- Please provide enough code so others can better understand or reproduce the problem. – Community Bot Commented yesterday
1 Answer
Reset to default 0The equivalent of .collection_with_type()
in the latest 3.x versions is just .collection()
.
The original .collection()
in 1.2.0 as used in your article would always create a Collection<Document>
and you'd have to use .collection_with_type()
to get a different object type. That was changed in 2.x - there is no longer a default collection type so .collection()
works for all collections.