Devolutions / mongodm-rs

A thin ODM layer for mongodb
30 stars 9 forks source link

feat(deps)!: upgrade odm layer to MongDB Rust driver v3.0.0 #30

Closed douggynix closed 1 month ago

douggynix commented 1 month ago

This pull request is related to that issue below I have opened to switch to the newer version of Mongodb Rust Driver v3.0.0 Issue : https://github.com/Devolutions/mongodm-rs/issues/29

Mongodb team introduced a lot of broken changes as a regard to the former api in 2.x. Some methods have their arguments reduced, or some errors have been renamed. A lot of refactoring resulted in having build errors for features that have been also removed in Cargo.

This pull request is opened to address those. I have run the Unit test and it ran successfully. Feel free to review, fix, accept or deny this PR.

Here is one of the PR from Mongodb Driver Rust team from which originates those broken changes from the APIs: https://github.com/mongodb/mongo-rust-driver/pull/1046 FindOptions, FindOneOptions and so on are removed from find method arguments and encapsulated by chain calling explicitly a with_options()

db.collection.find_one(doc).with_options(find_one_options) ;
db.collection.insert_one(&doc).with_options(insert_options).session(session);

image

Additional PR from mongodb rust team with broken changes from the former 2.x api: //See driver pull request change for errors: https://github.com/mongodb/mongo-rust-driver/pull/1102

douggynix commented 1 month ago

@CBenoit : I am done with my changes. Feel free to do the last reviews for refactoring if needed in order to have it merged. I have also tested my changes as an external depency against a code based i am working on which depends on this crate with the mongodb rust driver v3.0.0. and it works

douggynix commented 1 month ago

Any update or another review to have this merged?