Azure / azure-cosmos-dotnet-v3

.NET SDK for Azure Cosmos DB for the core SQL API
MIT License
723 stars 477 forks source link

What is the stream needed for or how is it used in `PatchItemStreamAsync`? #4508

Open Astral100 opened 1 month ago

Astral100 commented 1 month ago

Hello, looking at the example of PatchItemStreamAsync in the code example below, I can see that stream is created from Patch operations but then it is not getting used, as there is no reference to this variable in the code below:

https://github.com/Azure/azure-cosmos-dotnet-v3/blob/618d120b449f659ce74acf4a4b6c8bc77ccde946/Microsoft.Azure.Cosmos.Samples/Usage/ItemManagement/Program.cs#L551

Then the question is how PatchItemStreamAsync is using streams? Is it using them internally? Or it is not using streams at all? Or do I misunderstand something?

ealsur commented 1 month ago

This seems to be a bug on the samples, thanks for pointing this out. PatchItem as an operation takes always a structured input but the difference is in the output.

Stream operations do not do deserialization nor throw exceptions on failed responses.

We'll update the samples.

Astral100 commented 1 month ago

Oh I see! Thank you very much for explaining it.