I am trying to create a azure cosmos database and collection in my c# code.
await client.CreateDatabaseIfNotExistsAsync(new Database() { Id = "data"});
DocumentCollection dCollection = await client.CreateDocumentCollectionIfNotExistsAsync(UriFactory.CreateDatabaseUri("data"), new DocumentCollection { Id = "coll"}, new RequestOptions { OfferThroughput = 400, , PartitionKey = new PartitionKey("/id") });
// dashboardCollection.PartitionKey.Paths.Add("/id");
When I go to portal.azure.com and check my document DB, the collection is created. When I go to Scale and Settings for the collection, I don't see a partition key.
I created another collection manually and it shows the partition key in the Scale and Settings section.
The delete function is throwing an error because of this partition key error
Inserted a record with id 1 successfully into the document DB. The following delete fails saying that the partitionKey is invalid.
ResourceResponse<Document> response = await client.DeleteDocumentAsync(UriFactory.CreateDocumentUri("data", "coll", "1"), new RequestOptions { PartitionKey = new PartitionKey("1") });