Loading TOC...

view.setFields

view.setFields(
   schema-name as String,
   view-name as String,
   fields as element(view.field)[]
) as null

Summary

This function sets the specified fields on the specified view. Any existing fields are replaced or removed.

Parameters
schema-name The name of the schema.
view-name The name of the view.
fields The sequence of field elements to be set on the view.

Example

const view = require('/MarkLogic/views');

view.setFields('main',
                'employees', 
                [view.field('Employee'), view.field('EmployeeID')] );

// Sets the "Employee" and "EmployeeID" fields on the "employees" view.
   

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