Loading TOC...

op.fromView

op.fromView(
   $schema as String,
   $view as String,
   [$qualifier as String],
   [$systemCols as String]
) as AccessPlan

Summary

This function reads a row set from a configured view over TDE-indexed rows or a predefined view over range indexes.

This function creates a row set without a limit. Use AccessPlan.prototype.limit or AccessPlan.prototype.offsetLimit to set a limit.

Parameters
$schema The name identifying the schema containing the view. If the schema name is null, the engine searches for a view with the specified name.
$view The name identifying a configured template or range view for rows projected from documents.
$qualifier Specifies a name for qualifying the column names in place of the combination of the schema and view names. Use cases for the qualifier include self joins. Using an empty string removes all qualification from the column names.
$systemCols An optional named fragment id column returned by op.fragmentIdCol. One use case for fragment ids is in joins with lexicons or document content.

Usage Notes

The fromView function is one of the Data Access Functions.

Example


const op = require('/MarkLogic/optic');
 
op.fromView('main', 'employees')
   .select(['EmployeeID', 'FirstName', 'LastName'])
   .orderBy('EmployeeID')
   .result();
  

Example


const op = require('/MarkLogic/optic');
 
op.fromView('main', 'employees', null, op.fragmentIdCol('docId'))
  .select(['EmployeeID', 'FirstName', 'LastName', 'Position', 'docId'])
  .result();
  

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