Loading TOC...

xdmp:document-remove-collections

xdmp:document-remove-collections(
   $uri as xs:string,
   $collections as xs:string*
) as empty-sequence()

Summary

Removes the named document from the given collections. For each collection that is protected, the user must have permissions to update that collection or have the any-collection privilege. For each unprotected collection, the user must have the unprotected-collections privilege.

Parameters
$uri The document URI.
$collections A set of collection URIs.

Example

xdmp:document-remove-collections(
  "/example.xml",
  ("http://examples.com", "http://marklogic.com"))

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.
  • what if I want to delete entire collection and its data under /uri/? xdmp:document-remove-collections( "/uri/*",("collection-1")) is throwing error as invalid uri
    • If you want to remove all documents under /uri/ from a collection, you'll need to loop through. Something like: cts:uris((), (), cts:directory-query("/uri/", "infinity")) ! xdmp:document-remove-collections(., "collection-1")
      • Thanks David. I managed with xdmp: collection-delete("collection Name") and it worked.
  • If the document is not in $collections, this function does not throw an error.