15 releases (6 breaking)
0.6.0 | Jul 7, 2019 |
---|---|
0.4.0 | Jun 19, 2019 |
0.3.3 | Mar 16, 2019 |
0.0.5 | Dec 15, 2018 |
0.0.1 | Jul 18, 2018 |
#2833 in Database interfaces
54 downloads per month
135KB
2K
SLoC
Avocado, the strongly-typed MongoDB driver
Usage
-
See the online documentation above, or open it locally:
-
cargo doc --open
-
Check out the
examples/
folder -
More high-level information can be found on the project page.
-
The
schema_validation
feature can be enabled (it's enabled by default), in which case theDatabaseExt::empty_collection()
method becomes available. If a collection is created using this method, it will add a JSON schema validation pass and specify the schema as generated bymagnet
. -
The
raw_uuid
feature (also enabled by default) adds some useful extension methods to make it more convenient to work with UUIDs as the type of the_id
field.This can potentially be slow if you are performing many insertions into a collection of a complex type. However, it dynamically ensures that other users/drivers can't put malformed data in the collection. Therefore it's probably more useful if you or somebody else are accessing a database from outside the Avocado driver too. It's also great for debugging Avocado itself.
Changelog
v0.6.0
- Fix #6 by adding a context dictionary to
Error
.
v0.5.0
- Fix #5 by adding an
#[options(...)]
attribute to theDoc
derive proc-macro.
v0.4.0
- Fix #2 by adding a
&self
parameter to theoptions()
methods onops::
traits.
v0.3.3
- Fix a deprecation warning related to
Uuid::from_random_bytes()
- Catch some errors that incorrectly pass through the MongoDB client's
Cursor
API
v0.3.2
- Added a
remove_inner_doc()
method toDocumentExt
. This allows for the easy chaining of removal from hierarchically containedDocument
s intransform()
. - Fixed a bug where inserting 0 entities into a collection failed.
- Fixed the incorrect ordering of the key and the value type in the error message generated by
DocumentExt::remove_*()
methods.
v0.3.1
- Added a
DocumentExt
trait to the prelude for convenient and idiomatic implementation oftransform(raw: Document) -> Result<Bson>
methods - Hopefully fixed the code so that docs.rs can handle it now
v0.3.0
- Added
Doc::id()
andDoc::set_id()
methods for the sake of better efficiency in someCollection
methods- This means that single-element wrappers such as
Box<Doc>
andRefCell<Doc>
can no longer implementDoc
themselves
- This means that single-element wrappers such as
- Added
Collection::find_one_and_delete()
,Collection::find_one_and_replace()
, andCollection::find_one_and_update()
methods - Added more documentation and clarified/improved existing docs
- Added more tests, including compile-time tests for cases when
#[derive(Doc)]
should fail, as well as testing that an optional_id
is correctly allowed
Compile-time testing the derive macro
Due to a bug in compiletest_rs
, running the tests that check the error
messages of the #[derive(Doc)]
proc-macro requires running cargo clean
first, otherwise compilation will fail with E0464
.
Therefore, the recommended way of running the tests is:
cargo clean && cargo test
TODO:
- Add
weights
property to text indices - Add migrations
- Default
Doc::Id
toObjectId
andQuery::Output
andFindAndUpdate::Output
toT
, once #29661 is stabilized
Dependencies
~16MB
~315K SLoC