Skip to content

After mutate, how to get the new record or uid ? #17

@pandagood

Description

@pandagood

Hi
I encountered some problems when using txn.mutate. This is my code:

let post = json!({
        "content":"I'm creating post...",
        "entities":{
            "mentions":[
			    {"uid": "0x4e26"}
		    ],
            "urls":[
			    { "url": "https://github.com/chronotope/chrono", "size": 235334 }
		    ]
        },
        "medias":{
            "video":{
                "media_type": "Video",
                "url": "https://pbs.twimg.com/media/EaoKttmXsAEQcK5",
            },
            "photos":[{
                "media_type": "Video",
                "url": "https://pbs.twimg.com/media/EaoKttmXsAEQcK5",
            }]
       }
});

let mut mu = Mutation::new();
mu.set_set_json(& post)?;
let mut txn = self.client.new_mutated_txn();
let response = txn.mutate(mu).await?;
txn.commit().await?;

println!("{:?}", response);
println!("{:?}", response.uids);

I want to get the new post after mutate, but the response did not return it.

So I can only get the uid of the new post, but I got the uids map:

{"dg.685636434.37": "0xc377", "dg.685636434.40": "0xc375", "dg.685636434.35": "0xc376", "dg.685636434.38": "0xc374", "dg.685636434.39": "0xc373", "dg.685636434.36": "0xc378"}

I don’t know which is the post uid at all, and I don’t know how to get it

Please help me, thanks.

Metadata

Metadata

Assignees

Labels

documentationImprovements or additions to documentationquestionFurther information is requested

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions