Skip to main content

Using MarkLogic Content Pump (mlcp)

Input Parameters

The content parameter is an object containing data about the original input document. The content parameter has the following form:

{ uri: string,
  value: node}

The type of node your function receives in content.value depends on the input document type, as determined by mlcp from the -document_type option or URI extension. For details, see How mlcp Determines Document Type. The type of node your function returns in the value property should follow the same guidelines.

The table below outlines the relationship between document type and the node type your transform function should expect (or return).

Document Type

“value” node type

XML

document-node

JSON

document-node

BINARY

binary-node

TEXT

text-node

The context parameter can contain context information about the insertion, such as any transform-specific parameters passed on the mlcp command line. The context parameter has the following form:

{ transform_param: string,  collections: [ string, ... ],
  permissions: [ object, ... ],
  quality: number,
  temporalCollection: string}

The following table describes the properties of the input parameters in more detail:

Parameter

Description

content

  • uri - The URI of the document being inserted into the database.

  • value - The contents of the input document, as a document node, binary node, or text node; see below.

  • transform_param - The value passed by the client through the -transform_param option, if any. Your function is responsible for parsing and validation of the input string.

  • collections : Collection URIs specified by the -output_collections option. Value format: An array of strings.

  • permissions : Permissions specified by the -output_permissions option. Value format: An array of permissions objects, as produced by xdmp.permission.

  • quality : The document quality specified by the -output_quality parameter. Value format: A number.

  • temporalCollection : The temporal collection URI specified by the -temporal-collection parameter. Value format: A string.

The collections, permissions, quality, and temporal collection metadata from the mlcp command line is made available to your function so that you can modify or replace the values. If a given metadata category is not specified on the command line, the property will not be present in the context object.