MarkLogic 10 Product Documentation
dls.documentAddCollections

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

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

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

const dls = require('/MarkLogic/dls');
  
declareUpdate();
dls.documentAddCollections(
        '/foo/bar/baz.xml',
        'http://marklogic.com/documents/foo');
   
Powered by MarkLogic Server | Terms of Use | Privacy Policy