view.setColumns( schema-name as String, view-name as String, columns as element(view.column)[] ) as null
This function replaces the current set of column specifications on the named view in the named schema with a new set of columns.
const view = require('/MarkLogic/views'); view.setColumns('main', 'songs', [view.column('uri', cts.uriReference()), view.column('title', cts.elementReference(xs.QName('TITLE'))), view.column('author', cts.elementReference(xs.QName('AUTHOR'))), view.column('album', cts.elementReference(xs.QName('ALBUM'), ('nullable'))), view.column('year', cts.elementReference(xs.QName('YEAR')))] ); // Sets five columns in the 'songs' view in the 'main' schema.