-
Type: Task
-
Resolution: Won't Fix
-
Priority: Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
yourlogarithm has created PR #1108: Macro for field projection proposal in mongo-rust-driver
Issue Text:
Usage example
```bash
cargo add mongodb -F projection_macro
```
```rust
use mongodb::options::
;
use serde::Deserialize;
#[derive(Project, Deserialize)]
struct Person
#[tokio::main]
async fn main() {
let client = mongodb::Client::with_uri_str("mongodb://localhost:27017").await.unwrap();
let projection = Person::project().name().age().address().build();
println!("{:?}", projection); // mongodb::bson::Document(
)
let options = FindOptions::builder().projection(projection).build();
let document = client.database("test").collection("people").find_one(None, options).unwrap().unwrap();
}
```