Search code examples
azure-cosmosdbasp.net-core-2.0document-database

DocumentDB document link for Azure Cosmos DB


If I have an Azure Cosmos database with the following setup

Database name: MyDatabase

Collection: MyCollection

How would I use UriFactory to create a document link to use in CreateDocumentAsync(documentLink, document)?

I had a look at the Microsoft documentation here but this seems to use a document id to delete the document, I want to create a document instead.


Solution

  • Uri myUri = UriFactory.CreateDocumentCollectionUri("MyDatabase", "MyCollection");