Azure function is not working after upgrading WebJobs.Extensions.CosmosDB and WebJobs.Extensions to the latest versions

Admin Limna 1 Reputation point
2023-01-04T15:36:53.267+00:00

Based on the below reference document we have done the changes for the latest version of Cosmos DB extension.

https://learn.microsoft.com/en-us/azure/cosmos-db/nosql/migrate-dotnet-v3?tabs=dotnet-v3#major-name-changes-from-v2-sdk-to-v3-sdk

In document its mentioned that 'Document ' has renamed to 'Item' and i have done the same changes,

276060-image.png

But still its showing error "The type or namespace name 'Document' could not be found (are you missing a using directive or an assembly reference?)"

276150-image.png

=> In Document client we had "DeleteDocumentAsync" for deleting the document . In Cosmos client , we coudnt see any methods to delete the document. Could you please share the replaced method of delete document in cosmos client

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,911 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MuthuKumaranMurugaachari-MSFT 22,441 Reputation points Moderator
    2023-01-05T16:23:59.32+00:00

    @Admin Limna Thank you for reaching out to Microsoft Q&A. This question is similar to other thread, and I just posted an answer to the thread. To summarize, Document type is no longer available if you use Microsoft.Azure.WebJobs.Extensions.CosmosDB with version 4.0.0. Also, there is no such type as Item and the recommendation is to use C# type instead of generic types. Please refer examples posted in SDK repo about Usage such as delete an item or read item etc.

    Feel free to add a comment if you have any additional questions or upvote it if helped.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.