EVICT
DQL language syntax for evicting documents locally
To permanently delete a document from a collection see DELETE
.
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.[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[order by]
represents the path within a document to use to order the dataset and order (ASC
orDESC
)
Examples of Evicting Documents
Here, documents from the cars
collection that have the document ID 123
get removed from the Ditto store:
As another example, the following snippet, once executed, results in the eviction of documents with timestamps greater than a certain value:
Using DQL to Evict Documents in the SDK
For specifics on evicting and deleting documents in all Ditto SDKs see SDK>CRUD>Removing Documents
.
Removing Data from Ditto Server
EVICT
can be enabled for Ditto Server by request. Please contact us if you’d like to use this feature.
Note that any data evicted from Ditto Server will reappear if it exists in any Small Peer devices connected to Ditto Server.
To permanently remove the data, you must first ensure the data is no longer subscribed to, and is already evicted, by any connected Small Peers. See Developing an Eviction Strategy for more.
Alternatively, data can be tombstoned from Ditto Server using the legacy API. See: Writing: HTTP (Legacy).
Developing an Eviction Strategy
Removing data from a distributed database is a difficult problem, and memory management requires careful consideration of both subscriptions and evictions.
To learn more about our recommended strategies, see SDK>CRUD>Removing Documents
.