cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jarra64
Frequent Visitor

Cosmos DB Delete Document Fails

I'm have very simple Power Automate using Cosmos DB connectors:

 

  1. Cosmos Get All Documents (V3)
    1. Apply to each body/Documents
      1. Cosmos Delete a document (V2)
        1. Database ID: xxx
        2. Collection ID: xxx
        3. Document ID: items('Apply_to_each')['id']

I have verified that all connections to db, collection and document Id's exist and return as expected.

I get the error:  Entity with the specified id does not exist in the system

The id does in fact exist checking in both Azure data explorer as well as the response from Get All Documents (V3). The Power Automate debugger lists the correct id in the Document ID field.

 

This one has me really confused! Thank you.

 

 

           

1 ACCEPTED SOLUTION

Accepted Solutions
enzocano
New Member

I had the same problem; you should define the proper partition key to fix it.

For example, if you partition key is `/id` you must add that to the delete step. Also, you must cast the partition key to be string by enclosing the value with double quotes ("<value>") if you are using string (reference).

 

The following example is to delete a testcosmos document with "testcosmos" partition key

 

enzocano_1-1654030809908.png

 

 

View solution in original post

2 REPLIES 2
enzocano
New Member

I had the same problem; you should define the proper partition key to fix it.

For example, if you partition key is `/id` you must add that to the delete step. Also, you must cast the partition key to be string by enclosing the value with double quotes ("<value>") if you are using string (reference).

 

The following example is to delete a testcosmos document with "testcosmos" partition key

 

enzocano_1-1654030809908.png

 

 

jarra64
Frequent Visitor

Thank you @enzocano I didn't realize the double quote requirement for string partition keys. 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (3,346)