Skip to content

Fail to deserialize TimeStamp . #122

@weiby3

Description

@weiby3

I want to deserialize str to my struct, but it gets error. The sample code is:

use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, Debug)]
struct Foo {
    ts: bson::TimeStamp,
}
fn main() -> Result<(), Box<dyn Error>> {
    let original_str = "{\"ts\":1403964864000}";
    let decoded_json = dbg!(serde_json::from_str::<Foo>(original_str)?);
    Ok(())
}

Its output is:

Error: Error("invalid type: integer `1403964864000`, expected a signed integer", line: 1, column: 19)

Metadata

Metadata

Assignees

No one assigned

    Labels

    tracked-in-jiraTicket filed in Mongo's Jira system

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions