最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Rust Mongodb generic collections: Can't find client.collection_with_type - Stack Overflow

programmeradmin1浏览0评论

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
Add a comment  | 

1 Answer 1

Reset to default 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.

发布评论

评论列表(0)

  1. 暂无评论