How can we improve Azure Cosmos DB?

It should be possible to remove a document by ID (without self-links)

I really don't understand how is it possible that DocumentDB doesn't allow you to delete a document by ID. You have to query for it first, then delete it using returned self-link. To me, deleting an item by ID is absolutely the must and I don't know any other database that cannot do this directly.

using (var client = new DocumentClient(...))
{
// I want to use my ID here instead of self-link
await client.DeleteDocumentAsync("dbs/1m1FAA==/.....");
}

360 votes
Vote
Sign in
(thinking…)
Sign in with: oidc
Signed in as (Sign out)
You have left! (?) (thinking…)
alex shared this idea  ·   ·  Flag idea as inappropriate…  ·  Admin →

11 comments

Sign in
(thinking…)
Sign in with: oidc
Signed in as (Sign out)
Submitting...
  • Anonymous commented  ·   ·  Flag as inappropriate

    I am having this exact issue with documentdb in a .net core project with the core document db package. Does anyone know if this is in that core package?

  • Anonymous commented  ·   ·  Flag as inappropriate

    The CreateDocumentUri and DeleteDocumentAsync doesn't work when you have a partitioned collection: it complains that a "PartitionKey value must be supplied for this operation". Is it possible to have an overload that accepts the PartitionKey also?

  • Andrew Potts commented  ·   ·  Flag as inappropriate

    The CreateDocumentUri and DeleteDocumentAsync doesn't work when you have a partitioned collection: it complains that a "PartitionKey value must be supplied for this operation". Is it possible to have an overload that accepts the PartitionKey also?

  • Bipin commented  ·   ·  Flag as inappropriate

    Wondering how do we handle the delete in a partitioned collection as I assume Db+Collection+Partition+id is the unique key .In that case where do we specify the partition in the selflink?

  • simon commented  ·   ·  Flag as inappropriate

    Please make It asap. This makes no sense delete an entity by self-link. We should always delete items by its ids, right?

  • Ryan commented  ·   ·  Flag as inappropriate

    Trying out DocumentDB and I'm struggling with this self-link nonsense as well.

  • Greg commented  ·   ·  Flag as inappropriate

    The reason we care so much about this is latency, not pricing. We want to send our users response as quick as possible (low latency) and making 2 requests is slower than making one -> slower response for websites

  • Tom Tucker commented  ·   ·  Flag as inappropriate

    I understand SelfLinks and can work with it but Documents, Collections, and Databases should
    have their "id" added to the SelfLink. Not given a separate id for the SelfLink.

    I think this is due to not having duplicate Database or Collection SelfLinks But let us control with our business logic what the Id's of the Collection Database or Documents are so we can reconstruct it on the client without needing to query a document for the selflink.

  • Anonymous commented  ·   ·  Flag as inappropriate

    Totally! The whole self-link concept is confusing. Why aren't IDs acting like IDs. Instead they are just another property that gets indexed.

Feedback and Knowledge Base