How do I directly convert chrono DateTime to MongoDB DateTime. This was possible in earlier version of MongoDB by adding the chrono feature
bson = { version = "3.1.0", features = ["chrono-0_4"] }
But in mongo v3x doing that throws
mismatched typesyou can use cargo tree to explore your dependency treerustcClick for full compiler diagnosticdatetime.rs(183, 1): two different versions of crate bson are being used; two types coming from two different versions of the same crate are different types even if they look the sameexpected DateTime, found DateTimerust-analyzerE0308
Which I think probably has to do with mongodb 3.x using bson internally and no longer needing to have bson and mongodb as two separate package.
But even when I do this in cargo mongodb = {version= "3.4.1", features = ["chrono-0_4"] } it still throws an error package xxx depends on mongodb with feature chrono-0_4 but mongodb does not have that feature.
All I want is a straightforward way of converting DateTime in chrono to bson, something similar to what we had earlier BsonDateTime::from_chrono(expiry) with the chrono-0_4 feature