Deleting Documents

isubiker edited this page Nov 28, 2011 · 17 revisions

Deleting Documents

There are two ways to delete a document or documents from the database, either by URI or by supplying a query. Both methods require issuing a DELETE request to the /store endpoint. Deleting a document removes its properties as well. If the document was in any collections that are empty after deleting, those collections are deleted as well.

The response of a DELETE request contains a list of the documents that were deleted and a HTTP status code of 200.

Deleting by URI

To delete a document by URI, append the URI of the document onto the store endpoint. For example, a DELETE request to the following url will delete the document with a uri of /user/123456.json:


If the document doesn't exist in the database, a 404 error is returned.

Deleting with a query

Instead of supplying the URI of the document to delete, a query can be supplied instead. The queries can take the form of either a string query or structured queries.

/store?structuredQuery={"key":"id", "equals": 123456}

The above requests will first find all the documents that match the supplied query. By default the DELETE request will fail if no documents are found (404 response) and will also fail if more than one document is found (400 response). This is in place to try and ensure that only the intended document is deleted. However, if the intention is to delete multiple documents, this can be achieved by specifying bulkDelete=true:


Use this mode with extreme caution as it can easily delete every document in the database. To perform a bulk delete and limit the number of documents that are deleted, include a limit parameter:


That request will delete the first 1000 documents that match the query. This can be useful to avoid an excessively large (and therefore slow) delete transaction.


This needs "Request Details" and "Examples" sections.

Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.