Skip to content

no field on type Update when using serde #6

Description

@Bernie

Hi, I am trying to use Mongo and Bson derived traits while having some of the fields remain handled by serde in order to have customized serialization/de-serialization for that field.

I have a very basic example here:

#[derive(Debug, Serialize, Deserialize)]
pub struct MySerdeType {
    embedded_attr: String
}

#[derive(Debug, Bson, Mongo)]
#[mongo(collection = "my_docs", field, filter, update)]
pub struct MyDoc {
    mongo_attr: String,
    #[mongo(serde)]
    #[bson(serde)]
    serde_attr: MySerdeType
}

Unfortunately, this fails to compile due to 'no field serde_attr on type my_doc::Update'.

If I remove the update attribute, then this compiles, but the model will not implement the AsUpdate or Update traits. Is this expected? Thanks!

Activity

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions