Skip to content

Conversation

daniel-larsen
Copy link
Contributor

@daniel-larsen daniel-larsen commented Oct 31, 2023

Adds partial document updates in data_cosmos. Partial document updates are described here , and the REST API is documented here. An example is shown below.

let operations = vec![
     Operation::add("/color", "silver")?,
     Operation::remove("/used"),
     Operation::set("/price", 355.45)?,
     Operation::incr("/inventory/quantity", 10)?,
     Operation::add("/tags/-", "featured-bikes")?,
     Operation::r#move("/inventory/color", "/color"),
];

document_client.patch_document(operations).await?;

@daniel-larsen daniel-larsen changed the title Adds document updates in data_cosmos Adds partial document updates in data_cosmos Oct 31, 2023
Add { path: String, value: Value },
Remove { path: String },
Set { path: String, value: Value },
Incr { path: String, value: Value },
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the documentation specifies this must be a positive or negative value, what are your thoughts on having this be a serde_json::value::Number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense to me.

@demoray demoray merged commit 9769158 into Azure:main Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants