Loading TOC...

xdmp:collection-delete

xdmp:collection-delete(
   $uri as xs:string
) as empty-sequence()

Summary

Deletes from the database every document in a collection. If there are no documents in the specified collection, then nothing is deleted, and xdmp:collection-delete still returns the empty sequence.

Parameters
$uri The URI of the collection to be deleted.

Example

xdmp:collection-delete("collection-uri")

Stack Overflow iconStack Overflow: Get the most useful answers to questions from the MarkLogic community, or ask your own question.

Comments

The commenting feature on this page is enabled by a third party. Comments posted to this page are publicly visible.
  • MarkLogic can execute a collection delete in two ways. First, the same as with most deletes by using write locks and journaling. Assuming a 128MB journal record there should be enough journal space to support up to 8 million deleted fragments per forest per transaction. Second, when certain circumstances are right, MarkLogic can do a "fast collection delete" which avoids the large journaling, and runs dramatically faster. Fast collection delete requires the directory-creation database setting to be manual (the default), no triggers defined on the database (the default), and no document-locks fragments in the database (the default). If these circumstances are true it means there are no side effects as a result of the deletes (no directory fragments to manage, no triggers to fire, no long-term locks to unwind), and MarkLogic can run the fast collection delete by simply updating the timestamps to mark as deleted the documents in the collection.