{"id":14956813,"url":"https://github.com/h2co3/avocado","last_synced_at":"2025-10-24T10:31:01.704Z","repository":{"id":57501410,"uuid":"140749233","full_name":"H2CO3/avocado","owner":"H2CO3","description":"Strongly-typed MongoDB driver for Rust","archived":false,"fork":false,"pushed_at":"2019-07-07T12:49:47.000Z","size":282,"stargazers_count":80,"open_issues_count":3,"forks_count":2,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-29T10:21:20.382Z","etag":null,"topics":["bson","bson-document","database","databases","json","json-schema","mongo","mongodb","mongodb-driver"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/H2CO3.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-12T18:13:30.000Z","updated_at":"2025-01-28T21:00:47.000Z","dependencies_parsed_at":"2022-09-06T17:11:58.989Z","dependency_job_id":null,"html_url":"https://github.com/H2CO3/avocado","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/H2CO3%2Favocado","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/H2CO3%2Favocado/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/H2CO3%2Favocado/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/H2CO3%2Favocado/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/H2CO3","download_url":"https://codeload.github.com/H2CO3/avocado/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237950882,"owners_count":19392667,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bson","bson-document","database","databases","json","json-schema","mongo","mongodb","mongodb-driver"],"created_at":"2024-09-24T13:13:34.637Z","updated_at":"2025-10-24T10:31:01.320Z","avatar_url":"https://github.com/H2CO3.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Avocado, the strongly-typed MongoDB driver\n\n[![Avocado on crates.io](https://img.shields.io/crates/v/avocado.svg)](https://crates.io/crates/avocado)\n[![Avocado on docs.rs](https://docs.rs/avocado/badge.svg)](https://docs.rs/avocado)\n[![rustc](https://img.shields.io/badge/rustc-1.32+-turquoise.svg)](https://blog.rust-lang.org/2019/01/17/Rust-1.32.0.html)\n[![Avocado Download](https://img.shields.io/crates/d/avocado.svg)](https://crates.io/crates/avocado)\n[![Avocado License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/H2CO3/avocado/blob/master/LICENSE.txt)\n[![Lines of Code](https://tokei.rs/b1/github/H2CO3/avocado)](https://github.com/Aaronepower/tokei)\n[![Twitter](https://img.shields.io/badge/twitter-@H2CO3_iOS-blue.svg?style=flat\u0026colorB=64A5DE\u0026label=Twitter)](http://twitter.com/H2CO3_iOS)\n\n[![goto counter](https://img.shields.io/github/search/H2CO3/avocado/goto.svg)](https://github.com/H2CO3/avocado/search?q=goto)\n[![unsafe counter](https://img.shields.io/github/search/H2CO3/avocado/unsafe.svg)](https://github.com/H2CO3/avocado/search?q=unsafe)\n[![fuck counter](https://img.shields.io/github/search/H2CO3/avocado/fuck.svg)](https://github.com/H2CO3/avocado/search?q=fuck)\n\n## Usage\n\n* See the [online documentation](https://docs.rs/avocado) above, or open it locally:\n* `cargo doc --open`\n* Check out the [`examples/`](https://github.com/H2CO3/avocado/blob/master/examples/) folder\n* More high-level information can be found on the [project page](https://h2co3.github.io/avocado/).\n* 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`](https://github.com/H2CO3/magnet).\n* 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.\n\n    **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.\n\n## Changelog\n\n### v0.6.0\n\n* Fix [#6](https://github.com/H2CO3/avocado/issues/6) by adding a context dictionary to `Error`.\n\n### v0.5.0\n\n* Fix [#5](https://github.com/H2CO3/avocado/issues/5) by adding an `#[options(...)]` attribute to the `Doc` derive proc-macro.\n\n### v0.4.0\n\n* Fix [#2](https://github.com/H2CO3/avocado/issues/2) by adding a `\u0026self` parameter to the `options()` methods on `ops::` traits.\n\n### v0.3.3\n\n* Fix a deprecation warning related to `Uuid::from_random_bytes()`\n* Catch some errors that incorrectly pass through the MongoDB client's `Cursor` API\n\n### v0.3.2\n\n* Added a `remove_inner_doc()` method to `DocumentExt`. This allows for the easy chaining of removal from hierarchically contained `Document`s in `transform()`.\n* Fixed a bug where inserting 0 entities into a collection failed.\n* Fixed the incorrect ordering of the key and the value type in the error message generated by `DocumentExt::remove_*()` methods.\n\n### v0.3.1\n* Added a `DocumentExt` trait to the prelude for convenient and idiomatic implementation of `transform(raw: Document) -\u003e Result\u003cBson\u003e` methods\n* Hopefully fixed the code so that docs.rs can handle it now\n\n### v0.3.0\n* Added `Doc::id()` and `Doc::set_id()` methods for the sake of better efficiency in some `Collection` methods\n    * This means that single-element wrappers such as `Box\u003cDoc\u003e` and `RefCell\u003cDoc\u003e` can no longer implement `Doc` themselves\n* Added `Collection::find_one_and_delete()`,  `Collection::find_one_and_replace()`, and `Collection::find_one_and_update()` methods\n* Added more documentation and clarified/improved existing docs\n* 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\n\n## Compile-time testing the derive macro\n\nDue to a bug in `compiletest_rs`, running the tests that check the error\nmessages of the `#[derive(Doc)]` proc-macro requires running `cargo clean`\nfirst, otherwise compilation will fail with `E0464`.\n\nTherefore, the recommended way of running the tests is:\n\n    cargo clean \u0026\u0026 cargo test\n\n## TODO:\n\n* Add `weights` property to text indices\n* Add migrations\n* Default `Doc::Id` to `ObjectId` and `Query::Output` and `FindAndUpdate::Output` to `T`, once [#29661](https://github.com/rust-lang/rust/issues/29661) is stabilized\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh2co3%2Favocado","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fh2co3%2Favocado","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fh2co3%2Favocado/lists"}