Releases: thedodd/wither
wither-v0.9.0
Now that Model::sync
index management is back, we are finally ready to release an official 0.9.0
. All of the changes released so far as part of the various 0.9.0-alpha.*
releases are included as part of this release. Big shoutout to @simoneromano96 for all of their hard work on the updates to Model::sync
, thank you!
added
- I am happy to announce that index management via
Model::sync
is back! This has taken much longer than intended, but it is finally back. It also has a few improvements where index options are diffed in order to ensure that subtle updates to an index are observed and indexes are re-created as needed. This closes #51. - Added the
delete_many
method.
wither-derive-v0.9.0
No significant changes, just matching the upcoming Wither 0.9.0 release.
Model trait methods now use `&db` instead of `db.clone()`
0.9.0-alpha.2
changed
- All Model trait methods have been updated to take a reference to a
mongodb::Database
instance, no moredb.clone()
required. Thanks to @mehmetsefabalik for pointing out that this is now possible with the 1.x version of the driver.
Re-export async_trait for code gen.
added
- Adding
async_trait::async_trait
macro as a pub export of thewither
crate, so that code generated fromwither_derive
can use#[wither::async_trait]
instead of requiring users to declareasync-trait
as a dependency. This seems like the right thing to do here ... we'll see. If this causes problems for you (which it shouldn't), please open an issue.
Async models, updated to mongodb@1.0 & more
For those new to this project, Wither is an ODM for MongoDB built on the official MongoDB Rust driver. This is an alpha release for 0.9.0
, and is overall shaping up to be an excellent release.
A major highlight, everything is async now! This is squarely due to the mongodb team's recent 1.0 release of the driver, which supports both tokio & async-std runtimes. Wither directly reaps the benefits of these updates, so big thanks to the MongoDB team.
Lots of other good stuff here, read on to learn more.
added
- Wither is now based on the official MongoDB Rust driver.
- Everything is now async. All model methods are now
async
. All synchronous code has been disabled, and will be removed from the tree soon. Model::read_concern
,Model::write_concern
&Model::selection_criteria
match the driver's updated mechanism for specifying these values. They may all be derived, and are always used viaModel::collection
and any of the model methods which interact with a model's collection.- Added new
ModelCursor
type which wraps a cursor and yields model instances.
changed
- All crates cut over to edition 2018.
- Updated lots of deps. Importantly:
mongodb@1.0
and is now a public export of this crate.bson@1.0
and is now a public export of this crate.
- Models are now constrained by
DeserializeOwned
, instead ofDeserialize
. This simplifies some aspects of theModel
trait. - Nearly all
Model
methods which interact with the collection have been updated to match the driver's new collection interface. Lots of good stuff here. Check out the docs.
index management
Index management has not yet been implemented in the mongodb driver as of 1.0
, and thus the index syncing features of Model::sync
have been temporarily disabled. The hope is that the mongodb team will be able to land their index management code in the driver soon, at which point we will re-enable the Model::sync
functionality.
If this is important to you, please head over to wither#51 and let us know!
Notwithstanding, there are a few other changes to note:
- we have introduced the
wither::IndexModel
struct as a placeholder. This allows ourModel
interface to stay mostly the same, and allows us to preserve our index derivations using the#[derive(Model)]
system. Model::sync
is still present and callable, but has been temporarily deprecated until we are able to figure out the index management story. I mostly chose to use the deprecation pattern, even if a bit inaccurate, because it guarantees that folks will have a compiler warning letting them know that the functionality has been temporarily disabled.
wither_derive
The model derivation system has been GREATLY improved. The entire crate has been refactored. The code should be much more approachable to new folks wanting to contribute, and should be easier to maintain going forward.
- Errors are now reported via
proc-macro-error
and are fully spanned (which means any attribute errors related to the derive system will be highlighted with pin-point accuracy at compile time). - We are now using
dtolnay
's excellent trybuild for testing the compilation of our derive system. Big win here. - Index derivations have also been greatly simplified. Now, indexes are specified on the model-level (instead of the field-level, as they were previously).
- Indexes are derived using a
keys
field and anoptions
field (which is optional). Both are expected to be quoteddoc!{...}
invocations. See the docs for more details.
removed
Index management :'(
... though this should only be temporary.
Full support for deriving indexes on EMBEDDED docs & find_one_and_* methods.
0.8
The core wither
crate is 100% backwards compatible with this release, but the Model
trait has received a few additional methods. Namely the find_one_and_(delete|replace|update)
methods. Came across a use case where I needed them and then realized that I never implemented them. Now they are here. Woot woot!
The wither_derive
crate has received a few backwards incompatible changes. The motivation behind doing this is detailed in #21. The main issue is that we need the derive system to be abstract enough to deal with embedded documents. The backwards incompatible changes are here.
- within
#[model(index())]
, theindex_type
attr has been reduced to simply beindex
. All of the same rules apply as before. This change was made for ergonomic reasons. Less typing. Easier to follow. - within
#[model(index())]
, thewith(...)
attr has been updated to support subdocuments. The new syntax for this attr iswith(field="...", index="...")
. Supply awith(...)
attr for each independent field to include. - within
#[model(index())]
, theweights(...)
attr has been updated for the same reason aswith
. Now, you need to supply oneweight(field="...", weight="...")
per field weight you are specifying.
The only net-new item being added here is that now, within #[model(index())]
, you can use the attr embedded="..."
to cause the index declaration to apply to the embedded document/field specified. See the docs for more details.
It is my sincere hope that this is the last breaking change I will need to make to this crate before promoting this crate to a 1.0.0
release. Let's hope! Please let me know if there are any issues you have with these updates.
0.7.0
Using mongodb 0.3.12 which re-exports bson crate.
0.6.3 Update changelog & contributing docs.