Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docs] How does projection work in Rust? #80

Open
wbrickner opened this issue Mar 18, 2021 · 1 comment
Open

[Docs] How does projection work in Rust? #80

wbrickner opened this issue Mar 18, 2021 · 1 comment

Comments

@wbrickner
Copy link

Hello,

wondering how this library can support document projection if not every field is an Option<T>?

For instance if I only want one field from matching documents, how is this possible in Wither, which returns my struct back to me?

It is supported under options, but I think deserialization will fail in this case, otherwise the application will have entered an unsound state.

Thank you.

@thedodd
Copy link
Owner

thedodd commented Mar 18, 2021

Hey Will, projection in Wither runs a bit counter to the purpose of Wither, which is to provide model-based interaction with your MongoDB data. You absolutely can use projections with the underlying driver, but you will get a raw BSON document back instead of a model instance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants