Loading TOC...


   $schema-name as String,
   $view-name as String,
   $scope as element(*,view.viewScope)
) as null


This function sets the scope of the named view in the named schema specification.

$schema-name The name of the schema specification containing the view.
$view-name The name of the view on which the scope is set.
$scope The scope to be set on the view. Use the view.elementViewScope function to set the scope to an element or the view.collectionViewScope function to set the scope to a collection.

For details on view scoping, see Defining View Scope in the SQL Data Modeling Guide.


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

view.setViewScope('main', 'songs', view.elementViewScope(xs.QName('SONG')));

// Sets the scope of the 'songs' view in the 'main' schema to the 
// element, 'SONGS'.

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