MarkLogic 12 EA 1 Product Documentation
ModifyPlan.prototype.joinDocAndUri

ModifyPlan.prototype.joinDocAndUri(
   docCol as Object,
   uriCol as String,
   sourceCol as Object
) as ModifyPlan

Summary

This method adds an uri column and a document column to rows based on an existing source column having a value of a document uri (which can be used to read other documents) or a fragment id (which can be used to read the source documents for rows). If the fragment id column is null in the row, the row is dropped from the rowset.

You should minimize the number of documents retrieved by filtering or limiting rows before joining documents.

Parameters
docCol The document column to add to the rows. This can be a string or a column, op.col, op.viewCol or op.schemaCol, specifying the name of the new column that should have the document as its value.
uriCol The uri column to add to the rows. This can be a string or a column, op.col, op.viewCol or op.schemaCol, specifying the name of the new column that should have the document uri as its value.
sourceCol The document uri or fragment id value. This is either an op.fragmentIdCol object specifying a fragment id column or a document uri column as string or as a column using op.col, op.viewCol or op.schemaCol. Joining on a fragment id is more efficient than joining on a uri column.

Usage Notes

joinDocAndUri is a method of the following classes:

Example

const op = require('/MarkLogic/optic');
op.fromSearch(cts.documentFormatQuery('json'), 'fragmentId')
  .joinDocAndUri('doc', 'uri', op.fragmentIdCol('fragmentId'))
  .result();
  

Example

const op = require('/MarkLogic/optic');
op.fromSearch(cts.documentFormatQuery('json'), 'fragmentId')
  .joinDocAndUri('doc', 'newUri', op.col('uri'))
  .result();
  
Powered by MarkLogic Server | Terms of Use | Privacy Policy