Delete Documents from CosmosDB based on condition through Query Explorer

GorvGoyl picture GorvGoyl · Jun 27, 2017 · Viewed 31.6k times · Source

What's the query or some other quick way to delete all the documents matching the where condition in a collection?
I want something like DELETE * FROM c WHERE c.DocumentType = 'EULA' but, apparently, it doesn't work.

Note: I'm not looking for any C# implementation for this.

Answer

Stopped Contributing picture Stopped Contributing · Jun 27, 2017

I want something like DELETE * FROM c WHERE c.DocumentType = 'EULA' but, apparently, it doesn't work.

Deleting documents this way is not supported. You would need to first select the documents using a SELECT query and then delete them separately. If you want, you can write the code for fetching & deleting in a stored procedure and then execute that stored procedure.