Skip to content
This repository has been archived by the owner on Jul 12, 2020. It is now read-only.

CosmonautClient.DeleteDocumentAsync does not seem to work #65

Closed
StickNitro opened this issue Feb 25, 2019 · 1 comment
Closed

CosmonautClient.DeleteDocumentAsync does not seem to work #65

StickNitro opened this issue Feb 25, 2019 · 1 comment

Comments

@StickNitro
Copy link

I have a generic service using the CosmonautClient and using shared collections, this is a single service with a single POST method that I then use to post Queries or Commands to the endpoint and return the relevant entity.

Everything in this setup works with the exception of the DeleteDocumentAsync method call which returns null and the subsequent query agains the same collection yields results containing the "deleted" document

var deleted = await this._cosmonautClient.DeleteDocumentAsync(this._databaseName, collectionName, message.Id, new RequestOptions { PartitionKey = new PartitionKey("id") });

Can you advise if this is a problem please?

NOTE: I have also tried getting the SelfLink and using the DocumentClient to delete the document this way but I get an exception stating the resource does not exist

@Elfocrash
Copy link
Owner

You need to provide the partition key value not the partition key definition when you delete. Your delete request should look like this, assuming the id is your partition key.

var deleted = await this._cosmonautClient.DeleteDocumentAsync(this._databaseName, collectionName, message.Id, new RequestOptions { PartitionKey = new PartitionKey(message.Id) });

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants