wither
wither copied to clipboard
[Docs] How does projection work in Rust?
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.
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.