Loading TOC...

xdmp:document-add-collections

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

Summary

Adds the named document to 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.

Required Privileges

If adding an unprotected collection to a document, the unprotected-collections privilege (http://marklogic.com/xdmp/privileges/unprotected-collections) is needed; if adding a protected collection, the user must have either permissions to update the collection or the any-collection privilege (http://marklogic.com/xdmp/privileges/any-collection).

Example

xdmp:document-add-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.