0

How can I delete item from cosmos Db document. I am trying below query but no luck.

delete from c where c.ode = '21423423'

PauCasademont
  • 279
  • 4
  • 18
itaustralia
  • 127
  • 1
  • 12
  • You can't delete items by query. You need to use the REST API (or any SDK implementing the API) and delete each item using it's `id` and partition key. – NotFound Jun 30 '22 at 07:23
  • 4
    Does this answer your question? [Cosmos DB - Deleting a document](https://stackoverflow.com/questions/46871925/cosmos-db-deleting-a-document) – David Makogon Jun 30 '22 at 13:48

2 Answers2

0

If you are using the Node.JS API, you can use the command:

container.item(id, partitionId).delete()

I recognize that there are many other APIs, but when I was trying to figure out how to do this for NodeJS this question came up but did not help me and this is the only API I know how to use / have time to answer.

AuWiMo
  • 120
  • 8
-1

The SQL API does not provide facilities for delete, this must be done through the REST API, Storage Explorer etc.

In addition, I saw the official reply that the delete function is not yet supported.

Jason Pan
  • 15,263
  • 1
  • 14
  • 29
  • Please don't post link-only answers. Also, this question is a duplicate of an already-answered question (as posted in my link under the question). – David Makogon Jun 30 '22 at 13:49