Search code examples
marklogicmarklogic-9marklogic-dhf

MarkLogic - Permanently delete all documents from temporal collection


MarkLogic version : 9.0-6.2

Is there a way to delete all documents physically from a temporal collection, or even delete the collection itself (like xdmp.collectionDelete on non-temporal collection).

We tried temporal.collectionRemove, but that works only when the temporal collection is empty.

We also tried looping through the temporal collection and applying temporal.documentDelete but that only ends the system end time, but the documents are physically available and can be returned by search.

Thanks in advance!


Solution

  • To flush your entire database (not for production obviously), you can use xdmp.forestClear.

    To flush only the temporal documents of one particular temporal collection: loop through them (potentially in batches), and use temporal.documentWipe.

    You might need to 'protect' each document first using temporal.documentProtect with a zero second duration.

    HTH!