-1

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.

1
  • Please provide enough code so others can better understand or reproduce the problem. Commented Apr 3 at 2:59

1 Answer 1

0

The 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.

Sign up to request clarification or add additional context in comments.

2 Comments

I figured that I was looking at something out of date. Thank you for the information. I'll rework my test according to your comments.
After getting the clarification on setting collection everything works as expected :o)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.