Loading TOC...

dls:document-add-collections

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

Summary

This function adds the named document to the specified collections.

Note that collections are not maintained in version history unless changes are also made to the content of the document.

Parameters
uri The URI of the document to be added to the collection.
collections A set of collection URIs.

Required Privileges

The dls-user role is required to run this function, or the privilege:
http://marklogic.com/xdmp/privileges/dls-user

For each collection that is protected, the user must have permissions to update that collection or the privilege:
http://marklogic.com/xdmp/privileges/any-collection

For each unprotected collection, the user must have the privilege:
http://marklogic.com/xdmp/privileges/unprotected-collections

The document must specify dls-user(update) permission.

Example

  xquery version "1.0-ml";

  import module namespace dls = "http://marklogic.com/xdmp/dls" 
      at "/MarkLogic/dls.xqy";

  dls:document-add-collections(
        "/foo/bar/baz.xml",
        "http://marklogic.com/documents/foo")

  (: Adds 'bax.xml' to the 'foo' collection. :)
    

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