DELETE
DQL language syntax for deleting documents
The DELETE
keyword is only available in the Small Peer SDK. Big Peer support will be coming soon. To delete documents via the Big Peer HTTP API use the
TOMBSTONE
keyword.
For more information on how to use delete and manage data reach out to Ditto’s Customer Support
The DELETE
keyword is only available in SDK version 4.10 and later
To remove a document from a Small Peer device without permanently deleting it see EVICT
.
The DELETE
operation permanently removes one or more documents from a Ditto collection. Once a document is
deleted it cannot be recovered. Deleted documents can be re-created by using the INSERT
operation with
the same document id as the deleted document.
Syntax
In this syntax:
your_collection_name
is the name of the collection from which you want to retrieve the data.[condition]
represents the condition or criteria that determine which documents should be evicted from the local peer.[order by]
represents the path within a document to use to order the dataset and order (ASC
orDESC
).[limit]
represents the maximum number of documents that should be evicted.[offset]
represents the offset from 0 that should be used for the eviction query, in practice this should be rarely used.
Examples of Deleting Documents
Here, the document with ID 123
is permanently removed from the cars
collection:
In the following snippet, all documents created before the defined value are removed:
Using DQL to Delete Documents in the SDK
For specifics on deleting documents in all Ditto SDKs see SDK>CRUD>Removing Documents
.
TOMBSTONE Keyword
The TOMBSTONE
keyword (currently Big Peer only) is a synonym for the new DELETE
keyword. Users using the TOMBSTONE
keyword will get the auto
cleanup properties of DELETE
without any changes.TOMBSTONE
will be deprecated/removed in an upcoming Major release.
Removing Fields from Documents
The DELETE
keyword is used to remove documents from a collection. To remove a specific field from a document see UPDATE>Deleting Fields
Was this page helpful?