Crates.io | avocado_derive |
lib.rs | avocado_derive |
version | 0.6.0 |
source | src |
created_at | 2018-12-25 16:29:28.595726 |
updated_at | 2019-07-07 12:50:10.915501 |
description | Avocado, the strongly-typed MongoDB driver |
homepage | https://h2co3.github.io/avocado/ |
repository | https://github.com/H2CO3/avocado.git |
max_upload_size | |
id | 103757 |
size | 49,799 |
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 the DatabaseExt::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 by magnet
.
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.
Error
.#[options(...)]
attribute to the Doc
derive proc-macro.&self
parameter to the options()
methods on ops::
traits.Uuid::from_random_bytes()
Cursor
APIremove_inner_doc()
method to DocumentExt
. This allows for the easy chaining of removal from hierarchically contained Document
s in transform()
.DocumentExt::remove_*()
methods.DocumentExt
trait to the prelude for convenient and idiomatic implementation of transform(raw: Document) -> Result<Bson>
methodsDoc::id()
and Doc::set_id()
methods for the sake of better efficiency in some Collection
methods
Box<Doc>
and RefCell<Doc>
can no longer implement Doc
themselvesCollection::find_one_and_delete()
, Collection::find_one_and_replace()
, and Collection::find_one_and_update()
methods#[derive(Doc)]
should fail, as well as testing that an optional _id
is correctly allowedDue 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
weights
property to text indicesDoc::Id
to ObjectId
and Query::Output
and FindAndUpdate::Output
to T
, once #29661 is stabilized