Loading TOC...

dls.documentSetProperty

dls.documentSetProperty(
   $uri as String,
   $property as Node
) as null

Summary

This function sets a property on a document. If any properties with the same property QName exist, they are replaced with the new property. If no properties exist with the same QName, the new property is added.

Parameters
$uri The URI of the document.
$property The property to set.

Required Privileges

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

Usage Notes

You cannot set any property nodes in the DLS namespace.

Example

// The 'priority' property is set to the 'foo/bar/baz.xml' document. 

  const dls = require('/MarkLogic/dls');
  
  declareUpdate();
  const properties = [
    new NodeBuilder().addElement('priority', '1').toNode()];
  dls.documentAddProperties('/foo/bar/baz.xml', properties);
   

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