Skip to content

no field on type Update when using serde #6

Open
@Bernie

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!

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