Loading TOC...

dls.documentSetCollections

dls.documentSetCollections(
   $uri as String,
   $collections as String[]
) as null

Summary

This function sets the named document to the specified collections. Any previously set collections for the document that are not specified are removed.

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 set 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

Example

// Sets 'baz.xml' to the 'foo' collection.

const dls = require('/MarkLogic/dls');

declareUpdate();
dls.documentSetCollections(
         '/foo/bar/baz.xml',
         'http://marklogic.com/documents/foo');
   

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