We want to run a query, in which all the items that are returned, are deleted. More clearly, what we want to do exactly is run a query, in which if an item matches the condition, it should be included in the response, and be deleted from Amazon DynamoDB. And then the query should go with the second option.
So, after the query would respond, there would no such orders exist in database, since they were deleted on the go.
An example workflow with 5 items (items sample img. below) would look like -
- A Query runs checking if
From
=Kartik
. - The query comes on 1st item (
1000
) & finds that it matches the condition. - It captures the item, and deletes it from the Table. Now, only the response contains this item, not the table.
- The query moves onto further items (
1001
&1002
) and finds that they don't fit under the condition, so it doesn't even capture them, and does not delete too. - The query finds the 4th item (
1003
) matching the condition. So, it captures it in the response, and deletes it from the table. - Same as above for the 5th item (
1004
).
Now, the query completes, and returns a response containing ONLY the 1st, 4th & 5th Item. Now if I go and look for them in DynamoDB, it would return an error because they were deleted from there.
So, that's how I want the flow to be. Any chances of this being possible to do?
Any help is appreciated! Thanks!